netolabs / simple-event-dispatcher
Basic event dispatcher based on the PSR-14 standard
v0.1.0
2020-03-09 05:16 UTC
Requires
- php: >=7.3
- psr/event-dispatcher: 1.0.*
Requires (Dev)
- phake/phake: 3.1.*
- phpmd/phpmd: 2.8.*
- phpunit/phpunit: ^7.5
- squizlabs/php_codesniffer: ^3.5
Provides
This package is auto-updated.
Last update: 2024-12-09 16:11:11 UTC
README
Basic event dispatcher based on the PSR-14 standard.
Install
Via Composer
$ composer require netolabs/simple-event-dispatcher
Requirements
PHP version 7.3 and up is required.
Usage
Adding a listener
$listenerProvider = new ListenerProvider(); $dispatcher = new EventDispatcher($listenerProvider); $listenerProvider->addListener(MyEvent::class, function() { // ... });
Emitting an event
$event = new MyEvent(); $dispatcher->dispatch($event);
License
The MIT License (MIT). Please see the License File for more information.