Download the PHP package fig/event-dispatcher-util without Composer
On this page you can find all versions of the php package fig/event-dispatcher-util. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download fig/event-dispatcher-util
More information about fig/event-dispatcher-util
Files in fig/event-dispatcher-util
Package event-dispatcher-util
Short Description Useful utility classes and traits for implementing the PSR events standard
License MIT
Homepage https://github.com/php-fig/event-dispatcher-util
Informations about the package event-dispatcher-util
PSR-14 Event Dispatcher Utility Library
This package contains a series of traits and base classes to cover the common, boilerplate portions of implementing a PSR-14-compliant event dispatcher library.
Install
Via Composer
Usage
Aggregate provider
The AggregateProvider class is a ListenerProvider implementation that collects and concatenates other listener providers. It is a simple wrapper that yields from a series of configured providers, in order.
The aggregate provider will now return all the listeners from YourProvider, followed by all the listeners from SomeOtherProvider.
Delegating provider
The DelegatingProvider is another multi-provider front-end. In this case, it can be configured such that certain event types will use one sub-provider, and others will use a different one. A given type can be configured with multiple sub-providers, and events will be matched using instanceof so that sub-classes of an event are also affected.
Now, events sent to the dispatcher that implement HttpEvent will be passed along to KernelListenerProvider only, while those that implement OrmEvent will be passed along to OrmListenerProvider only. Any other events will be passed on to the default provider only.
AggregateProvider and DelegateProvider are fully compatible with each other, so either can use an instance of the other as one of its sub-providers.
Parameter provider helpers
The ParameterDeriverTrait is a set of tools to help listener provider implementations with deriving the type of a callable's parameter, to know what type of event it is. PHP supports a wide variety of callable types, which are not always easy to disambiguate. The tools in this class help ease that process.
If you are not writing your own Provider registration mechanism, this trait will not be useful.
Testing
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security-related issues, please email one of the current PHP-FIG Secretaries instead of using the issue tracker.
License
This package is released under the MIT license. Please see License File for more information.