1. Go to this page and download the library: Download shieldon/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/ */
shieldon / event-dispatcher example snippets
composer
/**
* @param string $name The name of an event.
* @param string|array $func Callable function or class.
* @param int $priority The execution priority.
*
* @return bool
*/
\Shieldon\Event\Event::addLister(string $name, $func, int $priority = 10): bool
/**
* @param string $name The name of an event.
* @param array $args The arguments.
*
* @return mixed
*/
\Shieldon\Event\Event::doDispatch(string $name, array $args = []): mixed
\Shieldon\Event\Event::addListener('test_1', function() {
echo 'This is a closure function call.';
});