Download the PHP package bee4/events without Composer
On this page you can find all versions of the php package bee4/events. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Package events
Short Description Basic event dispatcher definition, implement basic Mediator pattern
License Apache-2.0
Informations about the package events
Bee4 / Events v1.1.0
The main goal of this code is to allow using Event Dispatcher pattern with different popular implementations :
- Symfony 2 Event Dispatcher component
- Événment Event Emittter component
- League Event component
This library does not intend to provide the whole possibilities of each adapters but a standard couple of interface which allow to do not depend from one vendor. This way, you can use your preferred event system with one of the bee4/events
lib user.
Installing
This project can be installed using Composer. Add the following to your composer.json:
or run this command:
Event System
DispatcherInterface
Define how an object must trigger an event. It contains 4 methods :
dispatch
to trigger an EventInterface instanceon
to attach a listeneronce
to attach a listener that will be ran then detachedremove
to remove a given listenerget
to retrieve all listeners attached to one event name
DispatcherAwareInterface
Define how an object can rely to a dispatcher to handle events. It contains 4 methods :
setDispatcher
to initialize the currentDispatcherInterface
getDispatcher
to retrieve the currentDispatcherInterface
hasDispatcher
to check if there is a currentDispatcherInterface
dispatch
to dispatch anEventInterface
on the linkDispatcherInterface
if there is one...
EventInterface
Define an event object which can be triggered. There is no default behaviour for this kind of object because an event can be really specific.
Adapters
I hope you don't want to create your own dispatcher because there are some cool stuff overhere.
There are adapters classes located in the Bee4\Events\Adapters
namespace :