PHP code example of jmikola / wildcard-event-dispatcher
1. Go to this page and download the library: Download jmikola/wildcard-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/ */
jmikola / wildcard-event-dispatcher example snippets
use Jmikola\WildcardEventDispatcher\WildcardEventDispatcher;
use Symfony\Component\EventDispatcher\Event;
$dispatcher = new WildcardEventDispatcher();
$dispatcher->addListener('core.*', function(Event $e) {
echo $e->getName();
});
$dispatcher->dispatch('core.request');
// "core.request" will be printed
use Jmikola\WildcardEventDispatcher\WildcardEventDispatcher;
use Symfony\Component\EventDispatcher\EventDispatcher;
$dispatcher = new WildcardEventDispatcher(new EventDispatcher());