Update: After some discussions the extensions config is fine. For modules there could be two other ways which I got following response:
Define a plugin manager for the component. These use SM configuration, and the component then pulls from the plugin manager when it needs an extension.
Compose an event manager and trigger an event. In the MVC, modules then attach listeners to that event (or, in Mezzio, you use a PSR-14 dispatcher, and wire in listeners in your listener provider).
I'm not yet sure if my
Module.php
are using best practices.Also not sure what the best way of
addExtension
in Latte and Twig is:Would be nice if somebody of Laminas Core Team could have a look at the existing Module.php definition of
Latte
: https://github.com/schranz-templating/templating/blob/0.1/src/Integration/Laminas/Latte/Module.phpWas also linked to delegators: https://docs.laminas.dev/laminas-servicemanager/delegators/ but not sure if that can solve extension registry problem as it is more like service registration.
Update: After some discussions the
extensions
config is fine. For modules there could be two other ways which I got following response: