1. Go to this page and download the library: Download zippovich2/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/ */
zippovich2 / event-dispatcher example snippets
use Zippovich2\EventDispatcher\EventDispatcher;
$dispatcher = new EventDispatcher();
// Add subscriber to events
$dispatcher->subscribe('event1', 'Subscriber::callback');
$dispatcher->subscribe('event2', 'Subscriber::callback2');
// Getting event subscribers
$event1Subscribers = $dispatcher->getSubscribers('event1');
// Or get subscribers from all events
$allSubscribers = $dispatcher->getSubscribers();
// Dispatch event
$dispatcher->dispatch('eventName');
use Zippovich2\EventDispatcher\TraceableEventDispatcher;
$dispatcher = new TraceableEventDispatcher();
// Add subscriber to events
$dispatcher->subscribe('event1', 'Subscriber::callback');
$dispatcher->subscribe('event2', 'Subscriber::callback2');
// Dispatch event return callstack tree
$callstackTree = $dispatcher->dispatch('eventName');
// Getting raw callstack
$callStack = $dispatcher->getCallStack();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.