PHP code example of julessutt / event-manager

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

    

julessutt / event-manager example snippets




use EventManager\Emitter;

$em = Emitter::getInstance();
$em->on('user.new', function ($user) {
    echo "New user: {$user->getName()}";
});

$em->emit('user.new', $user);