PHP code example of super-simple / event-dispatcher

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

    

super-simple / event-dispatcher example snippets




// New provider
$provider = new EventProvider();

// MyListener class must implement EventListenerable
$listener = new MyListener();

$provider->addListener($listener);

// New dispatcher
$dispatcher = new EventDispatcher($provider);

// Dispatch the event
// Event class must implement Psr/EventDispatcher/StoppableEventInterface
$event = new Event();

$dispatcher->dispatch($event);