League\Event\EventDispatcher is the primary point of interaction
Create an event dispatcher
use League\Event\EventDispatcher; $dispatcher = new EventDispatcher();
By default, the event dispatcher will create its own internal listener registry, which implements the listener interface as defined by PSR-14.
If needed, you can supply an alternate PSR-14 implementation in the constructor.
use League\Event\EventDispatcher; $dispatcher = new EventDispatcher($customListenerProvider);
Subscribing to events
Listeners can subscribe to events with the event dispatcher directly, or be registered with the default listener provider.
View the documentation on subscribing to events.