Regarding the architecture the general structure is explained in the next section as well as a detailed explanation of the EventDispatcher used to realize the event driven aspect of the plugin system.
Integration into architecture¶
If we take the already explained architecture from Architecture, we can add a third layer, the Plugin. From within the application either the Before Event is fired before the request is handled by the Endpoint or the After Event is fired after the endpoint handled it. This way of architecture decouples Endpoint and plugin so that none of them has to know about the other.
The Symfony EventDispatcher is a library for sending events between different components of your software.
If you adopt the diagram from below to the Connector the Producer is the Application, the Mediator is the EventDispatcher and the Consumer classes implementing our
IPlugin interface, see bootstrap.php.
As you can see it is possible to have more than one listener for the same kind of event.
Checkout this site for more information about the Symfony EventDispatcher.