PHP code example of hschulz / php-event-dispatcher
1. Go to this page and download the library: Download hschulz/php-event-dispatcher library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
hschulz / php-event-dispatcher example snippets
declare(strict_types=1);
ntDispatcher;
$dispatcher = new EventDispatcher();
$dispatcher->addListener('event.name', function ($event) {
echo 'Event triggered: ' . $event->getName() . PHP_EOL;
});
$dispatcher->dispatch('event.name');
bash
composer