hschulz / php-event-dispatcher
An implementation of the PSR-14 Event Dispatcher Interface.
0.1.7
2024-04-20 19:14 UTC
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.