dhii / event-dispatcher-interface
Standard interfaces for event handling.
Requires
- php: ^7.2 | ^8.0
- psr/event-dispatcher: ^1.0@dev
Requires (Dev)
- phpunit/phpunit: ^8.0 | ^9.0
- slevomat/coding-standard: ^6.0
- vimeo/psalm: ^4.0
This package is auto-updated.
Last update: 2024-11-29 06:10:01 UTC
README
Enhancements to PSR-14.
Details
This is a fork of the original event-dispatcher PSR package. The aim was to make it compatible with PHP 7.0, but now this package has evolved and is instead aimed to enhance the interfaces of PSR-14, which this package is fully compatible with.
Enhancements
The following interfaces extend the existing PSR-14 spec in order to provide interop for working with name-based events, e.g. in event models where an event is identified by its name rather than class, such as in WordPress.
AddListenerCapableInterface
allows adding a listener to an event identified by name, with priority.RemoveListenerCapableInterface
allows removing a listener by name and priority.
Shadows
The interfaces that simply shadow PSR-14 interfaces without changing anything are deprecated, namely:
EventDispatcherInterface
;IsPropagationStoppedCapableInterface
;ListenerProviderInterface
.
These will likely be removed in a future version, because they are redundant due to the new PHP 7.2 requirement allowing all the features of PSR-14. They are kept here in order to avoid breaking dependants that use them.