How alexisducerf/maarchcourrier works
Project Type and Purpose
• Maarch_Courrier is a monolithic, full-stack PHP web application providing electronic mail and document management (GEC).
• It supports desktop and smartphone clients, extensive modular features (attachments, life-cycle, full text, CMIS integration, SOAP/REST web services), and batch processes (indexing, notifications).
High-Level Architectural Components
a. Clients
• Desktop browsers (HTML/CSS/JS using apps/maarch_entreprise/js & css)
• Smartphone UI (apps/maarch_entreprise/smartphone)
b. Web Server Layer
• Nginx or Apache serving index.php and ws_server.php
• PHP-FPM or mod_php runtime
• Docker stack available in dockerphp56 for consistent dev/test
c. Application Layer (PHP code)
• Entry points:
– index.php (front controller)
– install/index.php (installation wizard)
– ws_server.php (SOAP/REST/XML-RPC endpoints)
• Core framework (core/): request routing, base controllers, security, session, service control, ORM/db abstraction
• Business modules (modules/ & apps/maarch_entreprise/): each feature comes as a module directory with:
– PHP controllers, classes (class/, ws.php)
– UI templates (template/, css/, js/, lang/, xml/IVS for validation, xml/services for API)
– SQL definitions (sql/data, sql/structure)
– Batch scripts for offline jobs (batch_tools, scripts/*.sh/.bat)
• Shared libraries (apps/maarch_entreprise/tools/): PEAR SOAP, Zend Lucene (full-text), Html2Text, Log4php, PDF libs, phpids, tinyMCE, QRCode, etc.
d. Data Storage
• Relational Database (PostgreSQL primary; supports MySQL/Oracle) – stores application data, modules’ tables, ACLs, history, indexing metadata.
• File storage for attachments, document conversions, PDF prints.
• Full-text index (Zend_Search_Lucene under tools/Zend/Search/Lucene).
e. External Services
• IMAP/SMTP for mail sending/receiving (php_imap, pear/SOAP for mail gateway)
• CMIS repository for document storage (class/cmis)
• LibreOffice, Ghostscript, wkhtmltopdf, Imagick for document conversions
• LDAP module for user synchronization (modules/ldap)
• Web services: SOAP, REST, XML-RPC endpoints provide CRM integration
f. Batch/CRON Jobs
• Full-text indexing (modules/full_text/scripts & batch)
• Notifications (modules/notifications/batch)
• Thumbnails generation (modules/thumbnails/batch)
• Life-cycle processes (modules/life_cycle/batch)
• Sendmail queue processing (modules/sendmail/batch)
Relationships and Data Flows
• Browser → HTTP → Web Server → PHP Front Controller → Core Router
• Router dispatches requests to modules/controllers under apps/ or modules/
• Controllers invoke domain classes (core/class, modules/*/class) → DB via PDO (class/class_db_pdo.php)
• Data returned to controllers → templates → HTML/CSS/JS to client
• File uploads/downloads managed via PHP and physical storage
• Batch scripts invoked by Cron → CLI PHP → modules’ batch_tools → DB/filesystem/index engine
Architectural Patterns & Principles
• Modular monolith: each feature encapsulated in its own directory with consistent structure (class, controller, view, sql, xml, lang, js, css).
• Front-controller & router in core/init.php → dispatch to object controllers.
• Data abstraction via core/class/class_db_pdo and class_db for multi-DB support.
• Separation of concerns: core framework vs feature modules vs shared tools.
• XML-driven configuration/validation (xml/IVS, xml/services, xml/menu).
• Support for extensibility: custom/ directory for overrides, modules can be added or disabled via XML.