swix / swix-em-config
Swix Event Manager configuration helper module. Allows to attach listeners and aggregates via application config
This package's canonical repository appears to be gone and the package has been frozen as a result.
Installs: 10 599
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: >=5.4.0
- zendframework/zendframework: 2.*
This package is auto-updated.
Last update: 2019-05-12 23:36:55 UTC
README
Zend Framework 2 module which provides possibility to attach event listeners and aggregates to SharedEventManager via configuration.
Installation
Add this line to your composer require
key: "swix/swix-em-config": "dev-master"
and update Composer. Then enable SwixEmConfig
module in your application config.
Important note
Event listeners can be attached only after loading of all modules (ModuleEvent::EVENT_LOAD_MODULES_POST)
Example
In your application or module config:
<?php use Zend\Mvc\MvcEvent; return [ 'service_manager' => [ 'invokables' => [ 'SomeAggregate' => 'SomeNamespaces\SomeAggregate', 'BootstrapListener' => 'SomeNamespaces\BootstrapListener' ] ], 'event_manager' => [ 'listeners' => [ // This listener will be retrived via ServiceManager ['event' => MvcEvent::EVENT_BOOTSTRAP, 'listener' => 'BootstrapListener'] // This listener will be created directly if its class exists ['event' => 'some_event', 'listener' => SomeNamespaces\WithoutSM\BootstrapListener::class] ], 'aggregates' => [ ['aggregate' => 'SomeAggregate'] ] ] ]