How yasblha/proquote_symfony works
1. Repository shape
- This is a Symfony 6.4 monolith built around classic MVC boundaries: Controller for HTTP entry points, Entity/Repository for persistence, Service for business logic, Form for request validation/input, and Twig templates for rendering.
- The app is centered on quote/invoice management, with supporting modules for clients, products/services, stock, payments, interactions, and user/account security.
2. Core domain model
- The main persistent entities are Client, Devis (quote), QuoteItem, Invoice, InvoiceItem, Payment, Interaction, Product, Service, and User.
- This implies a domain where a client can have quotes, invoices, payments, and interaction history, while products/services are catalog inputs for line items and stock-related operations.
3. Request/response layer
- Controllers are separated by feature: DashboardController, ClientController, DevisController, InvoiceController, PaymentController, ProductController, ServiceController, StockController, InteractionController, ExportController, plus auth/account controllers (Security, Registration, ResetPassword, JWT).
- MainController and AdminController likely provide landing/admin entry points, while ApiController and JWTController expose machine-oriented endpoints.
4. Business logic boundary
- Most non-trivial rules are extracted into services rather than staying in controllers.
- Key services are:
- DevisWorkflowService for quote lifecycle and conversion behavior
- PaymentService and PaymentDataService for payment processing/representation
- InvoicePdfService and PdfGenerator for document creation
- ExportService for report exports
- ReminderService and the reminder commands for scheduled follow-up
- DashboardStatsService for KPI aggregation
- ReferenceGenerator for document numbering/reference rules
- EmailService for outbound mail coordination
5. Primary business flow: quote to invoice
- The most important data flow is: create/edit quote → validate by client via tokenized link → accept/reject/expire → optionally convert to invoice.
- The repo includes dedicated validation pages under templates/devis/validation/* and a DevisValidationController, which makes client-side quote approval a distinct boundary from internal administration.
6. Billing and payment flow
- Invoices are a first-class aggregate, with line-item templates and PDF output.
- Payments are modeled separately from invoices, and a DataTransformer/PaymentDataTransformer.php suggests form/UI input is normalized before persistence or further processing.
- This separation supports a flow of invoice issuance → payment capture/recording → status tracking → reminders.
7. Presentation layer
- UI rendering is Twig-based, with feature folders for dashboard, client, devis, invoice, payment, product, service, stock, export, and account flows.
- Reusable UI is organized under templates/components and src/Twig/Components, indicating a componentized server-rendered UI.
- Frontend behavior is lightweight and mostly incremental: assets/ and public/js/controllers contain JavaScript controllers, with Symfony UX-style wiring (controllers.json, ux_live_component route).
8. Realtime and async infrastructure
- The app is configured with Mercure, Messenger, Mailer, and Notifier, so the architecture supports event-like updates, queued/background tasks, and outbound notifications.
- templates/broadcast/Invoice.stream.html.twig strongly suggests live invoice updates are broadcast to the UI, likely for dashboard or document stream refreshes.
9. Security and identity
- Authentication is handled by Symfony Security with a custom authenticator (AppAuthenticator) and a JWT path (LexikJWTAuthenticationBundle, JWTController).
- The repo also includes registration and password reset flows, plus validation utilities like a custom Siret constraint, which shows business-specific input validation is part of the security/data integrity boundary.
10. Stock, catalog, and operational data
- Product, Service, and StockController indicate the app is not just billing; it also manages catalog items and stock movements/alerts.
- The stock feature appears operationally separate from invoicing, but connected via shared product data and likely used to reflect inventory impact when items are sold or moved.
11. Exports, PDFs, and document generation
- There is a dedicated export path (config/routes/export.yaml, templates/export/*, docs/EXPORTS.md) and dedicated PDF templates for quotes, invoices, and financial reports.
- Document generation is therefore a distinct subsystem: domain data → Twig document template → PDF/export service → downloadable artifact or emailed document.
12. Infrastructure and runtime
- The repo is containerized with Docker, Caddy, and PHP-FPM, and uses Doctrine migrations against a relational database (README indicates PostgreSQL).
- Build/runtime tooling includes Composer, Node tooling for assets, Tailwind CSS, and Symfony’s asset pipeline configuration (asset_mapper, webpack_encore, symfonycasts_tailwind), which means the frontend is assembled from a mix of server-rendered Twig and compiled/static assets.
13. Background jobs and maintenance
- Console commands such as LoadFixturesCommand, SendRemindersCommand, and SendDevisRemindersCommand show that data seeding and reminder dispatch are scheduled/operational workflows rather than request-time logic.
- This separates interactive user actions from periodic maintenance and notification automation.
14. Testing and observability
- There are controller-level tests under tests/Controller, plus a Symfony test bootstrap and PHPUnit config.
- web_profiler, debug config, and flash-message partials imply the app is designed for iterative admin workflow with local inspection and diagnostics during development.
Main entry points: base.html.twig Twig UI · DevisWorkflowService.php Quote Workflow · Invoice.php Invoice Model · DevisController.php Quotes
Components 21
Presentation
HTTP entry points and Twig rendering
- Dashboard · Admin KPI landing page
src/Controller/DashboardController.php - Clients · Client CRUD entry point
src/Controller/ClientController.php - Quotes · Quote lifecycle entry point
src/Controller/DevisController.php - Validate Quote · Client-facing quote approval flow
src/Controller/DevisValidationController.php - Invoices · Invoice CRUD and document views
src/Controller/InvoiceController.php - Payments · Payment capture and listing
src/Controller/PaymentController.php - Catalog Ops · Products, services, stock, interaction, export, and settings entry points
- Auth Flow · Security, registration, password reset, JWT, and test mail
- Twig UI · Server-rendered views and reusable components
templates/base.html.twig
Domain
Core billing and catalog model
- Quote Model · Devis and quote items
src/Entity/Devis.php - Invoice Model · Invoice and invoice items
src/Entity/Invoice.php - Payment Model · Payments linked to billing
src/Entity/Payment.php - Client Model · Customer records and history
src/Entity/Client.php - Catalog Model · Products and services used in line items and stock
src/Entity/Product.php
Application
Business workflows and orchestration
- Quote Workflow · Quote lifecycle, acceptance, and conversion
src/Service/DevisWorkflowService.php - Payment Service · Payment processing coordination
src/Service/PaymentService.php - Billing Docs · PDF generation, reference rules, and payment data shaping
- Exports & Reminders · Financial export, reminders, and email delivery
- Stats · Dashboard KPI aggregation
src/Service/DashboardStatsService.php
Infrastructure
Security, async, export, and runtime support
- Security Stack · Authenticator and JWT authentication
src/Security/AppAuthenticator.php - Async Runtime · Messenger, Mercure, Mailer, and notifier-backed workflows
config/packages/messenger.yaml
Connections 29
- Dashboard → Stats: reads KPIs · Dashboard page is built from aggregated statistics
- Dashboard → Twig UI: renders · Uses Twig dashboard and shared components
- Clients → Client Model: manages · CRUD around client records
- Clients → Twig UI: renders · Client pages and forms
- Quotes → Quote Model: manages · Quote persistence and editing
- Quotes → Quote Workflow: orchestrates · Delegates lifecycle transitions and conversion
- Quotes → Twig UI: renders · Quote forms, lists, and PDFs
- Validate Quote → Quote Workflow: validates · Tokenized client approval flow
- Validate Quote → Twig UI: renders · Public validation pages
- Invoices → Invoice Model: manages · Invoice CRUD and line items
- Invoices → Billing Docs: creates docs · Invoice PDF generation and reference handling
- Invoices → Twig UI: renders · Invoice views and templates
- Payments → Payment Model: manages · Payment records and status
- Payments → Payment Service: delegates · Business rules for payment handling
- Payments → Twig UI: renders · Payment screens
- Catalog Ops → Catalog Model: manages · Products, services, stock, and interactions share catalog data
- Catalog Ops → Twig UI: renders · Catalog, stock, export, and settings pages
- Auth Flow → Security Stack: authenticates · Login, registration, reset, and JWT paths
- Auth Flow → Twig UI: renders · Authentication and account views
- Quote Workflow → Quote Model: updates · Transitions quote state and acceptance
- Quote Workflow → Invoice Model: converts · Creates invoices from accepted quotes
- Payment Service → Payment Model: persists · Coordinates payment domain changes
- Billing Docs → Invoice Model: uses · Invoice PDF and numbering depend on billing model
- Billing Docs → Catalog Model: uses · Line items and documents reference catalog data
- Billing Docs → Twig UI: builds documents · Twig templates drive PDFs and exports
- Exports & Reminders → Async Runtime: runs on · Background mail, messenger, and scheduled jobs
- Exports & Reminders → Twig UI: renders · Export and email templates
- Stats → Invoice Model: reads · Aggregates billing activity
- Stats → Payment Model: reads · Aggregates payment activity