frankdejonge / league-event-bundle
Symfony Bundle for the league/event.
Installs: 41 175
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 1
Open Issues: 2
Requires
- php: >=5.5
- league/event: ~2.0
- symfony/framework-bundle: ~2.3|~3.0
- symfony/yaml: ~2.3|~3.0
Requires (Dev)
- matthiasnoback/symfony-dependency-injection-test: ^0.7.4
- mockery/mockery: ^0.9.4
- phpunit/phpunit: ^4.5|^5.0
This package is auto-updated.
Last update: 2024-11-06 08:59:29 UTC
README
Installation
composer require frankdejonge/league-event-bundle
Register the bundle:
$bundles = array( ... new FrankDeJonge\LeagueEventBundle\LeagueEventBundle(), ... );
Usage
By default an emitter is registered under the league_event.emitter
id.
$emitter = $container->get('league_event.emitter');
Event listeners can be added to the emitter by tagging it with league_event.emitter
.
--- services: my_listener: class: Some\Listener tags: - name: league_event.listener event: event.name
Advanced usage
Register custom emitters with custom listener bindings:
--- services: my_emitter: class: League\Event\Emitter tags: - name: league_event.emitter listener_tag: my_emitter.listener my_listener: class: My\Awesome\Listener tags: - name: my_emitter.listener event: My\Awesome\DomainEvent
Setting priorities is also possible:
--- services: my_listener: class: My\Awesome\Listener tags: - name: league_event.listener event: My\Awesome\DomainEvent priority: 9001