laminas / laminas-eventmanager

Trigger and listen to events within a PHP application
https://docs.laminas.dev/laminas-eventmanager/
BSD 3-Clause "New" or "Revised" License
1.01k stars 13 forks source link

ListenerAggregatePluginManager? #3

Open weierophinney opened 4 years ago

weierophinney commented 4 years ago

hi Team,

assuming that an application has factories for its listeners, it would be nice to configure them in a central location and to not pollute the service container. any interest?

thanks : )


Originally posted by @abacaphiliac at https://github.com/zendframework/zend-eventmanager/issues/59

weierophinney commented 4 years ago

I would say that your application should consist auf multiple modules so there are not so many listeners within the service container to have another plugin manager created.

Also you could simply use another php file to separate your listeners to an own config file.


Originally posted by @reinfi at https://github.com/zendframework/zend-eventmanager/issues/59#issuecomment-333324834

weierophinney commented 4 years ago

true, i do take advantage of separate modules and PHP files. but in the merged config all services are listed and available from the application service container despite my modular separation.

a listener plugin manager would provide only implementations of the listener interface, so we would gain some type-safety as well as a reduction in the overall number of services registered in the main application service container.


Originally posted by @abacaphiliac at https://github.com/zendframework/zend-eventmanager/issues/59#issuecomment-334647245