Download the PHP package pleets/php-event-dispatcher without Composer
On this page you can find all versions of the php package pleets/php-event-dispatcher. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download pleets/php-event-dispatcher
More information about pleets/php-event-dispatcher
Files in pleets/php-event-dispatcher
Package php-event-dispatcher
Short Description PSR-14 Event Dispatcher
License MIT
Homepage https://pleets.org
Informations about the package php-event-dispatcher
PSR-14 Event Dispatcher
Event Dispatching is a common and well-tested mechanism to allow developers to inject logic into an application easily and consistently. This library was developed according to PSR-14 and all interfaces in psr/event-dispatcher were implemented.
You can download this project as follows.
Usage
Creating Events
An Event is a message produced by an Emitter. It may be any arbitrary PHP object.
You can create an event extending the Event
class.
Creating Listeners
A Listener is any PHP callable that expects to be passed an Event. Zero or more Listeners may be passed the same Event.
A Listener MAY enqueue some other asynchronous behavior if it so chooses.
You can create a listener extending the Listener
class.
Creating Listener Providers and subscribing events
A Listener Provider is responsible for determining what Listeners are relevant for a given Event, but MUST NOT call the Listeners itself. A Listener Provider may specify zero or more relevant Listeners. You can create a listener provider as follows.
Dispatching your events
A Dispatcher is a service object that is given an Event object by an Emitter. The Dispatcher is responsible for ensuring that the Event is passed to all relevant Listeners, but MUST defer determining the responsible listeners to a Listener Provider. You can dispatch you events as follows.
All listeners will be informed about this event and will be executed.