Skip to content

Dhii/event-dispatcher-interface

 
 

Repository files navigation

Event Dispatcher

Continuous Integration Latest Stable Version Latest Unstable Version

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.

About

Standard interfaces for event handling

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 84.7%
  • Dockerfile 13.3%
  • Shell 2.0%