PHP code example of fastd / event

1. Go to this page and download the library: Download fastd/event 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/ */

    

fastd / event example snippets


$event = new \FastD\Event\Event('demo', function () {
    return 'demo event';
});

$result = $event->broadcast();

$this->assertEquals(['demo event'], $result);

$eventDispatch = new \FastD\Event\EventDispatcher();

$eventDispatch->on('demo', new DemoListener());

echo $eventDispatch->trigger('demo');

$this->expectOutputString('handle ok');