hschulz / php-event-dispatcher
An implementation of the PSR-14 Event Dispatcher Interface.
Installs: 19
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/hschulz/php-event-dispatcher
Requires
- php: ^7.4.0
README
An implementation of the PSR-14 Event Dispatcher Interface.
Installation
composer require hschulz/php-event-dispatcher
Usage
<?php declare(strict_types=1); require 'vendor/autoload.php'; use Hschulz\EventDispatcher\EventDispatcher; $dispatcher = new EventDispatcher(); $dispatcher->addListener('event.name', function ($event) { echo 'Event triggered: ' . $event->getName() . PHP_EOL; }); $dispatcher->dispatch('event.name');
License
This project is released under the MIT license.