Provides a config-based initializer that attaches listeners to implementations of \Zend\EventManager\EventsCapableInterface.
Tired of writing backwards-compatible logic in all of your factory code to wire up listeners? Is your service implementation registered with Zend's service manager? Then this package might be right for you!
This package provides a config-based initializer that attaches listeners to implementations of
When the service concrete is instantiated by service manager, it will pass through the initializer provided by this
package. If your service is Events Capable, then the initializer will check the config for registered listeners
to attach to the service's event manager.
Install the latest version with
composer require abacaphiliac/events-capable
- Add initializer.
- Add listener.
return [ 'service_manager' => [ 'factories' => [ \MyListener::class => \MyListenerFactory::class, ], 'initializers' => [ \abacaphiliac\EventsCapable\EventsCapableInitializer::class, ], ], ];
return [ 'abacaphiliac/events-capable' => [ 'eventsCapable' => [ \MyEventsCapableService::class => [ \MyListener::class, ], ], ], ];
composer install && vendor/bin/phing