vlakarados / eventure
Auryn based event dispatching
Installs: 4 053
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- rdlowrey/auryn: ^1.0
This package is not auto-updated.
Last update: 2024-06-08 17:43:23 UTC
README
Auryn event dispatching
What
A very small library to work with simple events.
The whole point of this library is to allow Auryn to inject dependencies straight to your event methods.
Install
composer require vlakarados/eventure
How
- Create a class and extend
\Eventure\Dispatcher
Any public method in this class will be a registered event for the corresponding dispatcher.
Two functions are used by the parent dispatcher class that may not be overriden (restricted event names):
dispatch()
,hasEvent()
.
- Inject the class instance in any other object across your project and use the
dispatch($eventName)
method to send the event.
Example
Examples are in the example/
directory, the ExampleDispatcher and the test bootstrap file.
TODO
- Callback dispatchers
- Remove method restriction
- Better README.md
- Better documentation
- Any documentation, actually
- Dispatcher class factory (?)
- Static event calls like
\App\Dispatchers\User::dispatch('logIn', array('userId' => 12345))
or\App\Dispatchers\User::logIn(array('userId' => 12345))
(?)