Emitter class is the main point of interest in the Event package. This is where you
register listeners and trigger events.
Creating the Emitter
use League\Event\Emitter; $emitter = new Emitter;
Listeners are registered through the
The listener can be of two types:
Optionally event flow can be influenced by setting a priority. Priorities are represented as integers.
$emitter->addListener('event.name', $listener, 100);
League\Event\EmitterInterface has 3 predefined priorities:
Events are emitted using the
$event = $emitter->emit($event);
The event can be of two types:
Emitting events in batches
$events = $emitter->emitBatch([$event, $event, $event]);
Emit Return Values
Events emitted are returned as the result. When emitting events in batches an array of events is returned.