Since 2020-09-28, this repository is moved to "archived status". Contact me if you are interessted in it.
Generic Event Handler Component
This free as in freedom project aims to deliver a generic and clean php event handler component.
@todo: Take a look on openhub.net.
mkdir -p vendor/net_bazzline/php_component_event_handler cd vendor/net_bazzline/php_component_event_handler git clone https://github.com/bazzline/php_component_event_handler .
composer require net_bazzline/php_component_event_handler:dev-master
The core idea is to separate the "an event happens" from the "react on the fact an event has happened". The separation is done by describing "an event happens" with the keyword "emit" while the "react on the fact an event has happened" is described by the keyword "dispatch".
It either ends up by using a runtime implementation, a REST based, a database based or a BUS based.
This repository only the really basics. To prevent you from installing and shipping code you are never going to use, the real implementations are done in other repositories.
- emitter - sends an event
- dispatcher - notifies listener that this event has been sent
- listener - does things when an event happens
- uses a generic event class to increase interoperability
- generic event emiter with real implementation in dedicated packages (bus, database, rest, runtime)
- build event
- emitter->emit(Event) (... runtime, rest based, database, bus)
- ImmediatelyEmitter (Runtime and Bus)
- DeferredEmitter (Rest Based and Database)
[...] With Event Sourcing we also capture each event. If we are using a persistent store the events will be persisted just the same as the ship objects are. I find it useful to say that we are persisting two different things an application state and an event log. [...] Event Sourcing also raises some possibilities for your overall architecture, particularly if you are looking for something that is very scalable. There is a fair amount of interest in 'event-driven architecture' these days. This term covers a fair range of ideas, but most of centers around systems communicating through event messages. Such systems can operate in a very loosely coupled parallel style which provides excellent horizontal scalability and resilience to systems failure. [...]
- event loop
- logs events in an audit.log or event.log (separate package)
- to discuss
- priority support (49 is default, 0 is most unimportant, 99 is most important)
- event propagation can be stopped
- 0.0.1 - released at 15.09.2016
Star it if you like it :-). Add issues if you need it. Pull patches if you enjoy it. Write a blog entry if use it. Make a donation if you love it :-].