Mezzio Overview
Sirius uses the Mezzio Framework for the core of building its various PHP components. You can find out more at the Mezzio documentation
It’s useful to know where to look for key elements and how they relate to the whole. All requests broadly follow the same path shown in:
Nginx (our web server) hands off any non-filesystem web requests to the php runtime running in php-fpm.
These are all handled by index.php, which loads the PHP autoloader, the PSR-11 container and configuration, and then starts the Mezzio pipeline. The pipeline is made up of a series of PSR-15 middleware which are called, in order, in a nested approach. This allows the middleware can act before or after the next one in the chain, and can stop the next chained middleware from acting.
Front end
We map PSR-15 handlers to routes, which return a HTTP response object. This is a relatively straightforward mezzio app structure.
Back end
The last step of the pipeline is a PSR-15 ServerRequest handler, which uses the routing information to identify which CQRS command/query to run. Ultimately, this makes all of the mezzio pipeline a bit of a nothingness to most Sirius development: we just create CQRS commands/queries with routing information tagged in attributes and their corresponding handlers.
Modules are used to partition up similar pieces of application logic. Most of the work in Sirius goes on in the Application module, but some areas such as DDC (Document capture handling) and Finance are given their own areas. Modules should generally provide a small public API, with most of their logic being internal.
