1. Go to this page and download the library: Download phly/phly-event-emitter 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/ */
phly / phly-event-emitter example snippets
use Phly\EventEmitter\MessageNotifier;
use Phly\EventEmitter\ListenerProvider;
$listeners = new ListenerProvider();
$listeners->on(BootstrapEvent::class, function ($e) {
// do something with the bootstrap event
});
$notifier = new MessageNotifier($listeners);
$notifier->notify(new BootstrapEvent($params));
use Phly\EventEmitter\TaskProcessor;
use Phly\EventEmitter\PrioritizedListenerProvider;
$listeners = new PrioritizedListenerProvider();
$listeners->on(BootstrapTask::class, function ($e) {
echo 1, PHP_EOL;
}, -100);
$listeners->on(BootstrapTask::class, function ($e) {
echo 2, PHP_EOL;
}, 100);
$listeners->on(BootstrapTask::class, function ($e) {
echo 3, PHP_EOL;
}, 1);
$processor = new TaskProcessor($listeners);
$processor->process(new BootstrapTask($params));
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.