Download the PHP package nathanburkett/event-dispatcher without Composer
On this page you can find all versions of the php package nathanburkett/event-dispatcher. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download nathanburkett/event-dispatcher
More information about nathanburkett/event-dispatcher
Files in nathanburkett/event-dispatcher
Package event-dispatcher
Short Description PSR-14 Event Dispatcher implementation
License MIT
Informations about the package event-dispatcher
Event Dispatcher
A PSR-14 implementation which uses a Resolver to inject dependencies from a container when resolving EventListeners.
A ListenerProvider and observes priority from highest to lowest.
This means a ListenerProvider can already have multiple Subscriptions but could add another at run time whose priority facilitates the EventListener being handled first:
Installation
Via Composer
Usage
Events are paired with EventListeners through Subscriptions. Subscriptions take an Event class, a Listener class, and an optional priority assignment of where the Listener should be called in relation to other Listeners for the same Event in a ListenerProvider.
ListenerProviders hold Subscriptions and are also responsible for prioritizing and resolving Listeners so their callable is consumable.
An attach new ones before or during execution. The EventDispatcher facilitates an Event moving through the EventListener invocation pipeline and will halt further EventListener calls if the Event's propagation should be stopped.
An making their way to an EventDispatcher.
Basic Implementation
Then a ListenerProvider can track Subscriptions:
An EventDispatcher must be made aware of the new ListenerProvider
And finally an EventEmitter needs to consume the EventDispatcher and is ready to send Events