PHP code example of netolabs / simple-event-dispatcher
1. Go to this page and download the library: Download netolabs/simple-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/ */
netolabs / simple-event-dispatcher example snippets
php
$listenerProvider = new ListenerProvider();
$dispatcher = new EventDispatcher($listenerProvider);
$listenerProvider->addListener(MyEvent::class, function() {
// ...
});
php
$event = new MyEvent();
$dispatcher->dispatch($event);