PHP code example of open-engine / event-dispatcher
1. Go to this page and download the library: Download open-engine/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/ */
open-engine / event-dispatcher example snippets
$dispatcher = new EventDispatcher($listenerProvier);
$event = $dispatcher->dispatch(new FooEvent());
$config = new ListenerProviderConfig();
$config->addListener(FooEvent::class, function (FooEvent $event) {
// do somthing
return $event;
}, 20);
$config->addListener(FooEvent::class, '\Acme\listeners\AnotherListener::methodName');
// add another listeners
$listenerProvider = new ListenerProvider($config);