PHP code example of gmbn / eventphp

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

    

gmbn / eventphp example snippets


$e = new \EventPHP\Event();//start global event 

$e->on('pedidoFinalizado', function($codigo, $valor) use ($e){
    $r = $valor+=10;
    $e->trigger('pedidoCancelado', ['b001']);
    echo $r . "\n";
});

$e->on('pedidoFinalizado', function($codigo, $valor) {
    $r = $valor+=0;
    echo $r . "\n";
});


$e->on('pedidoCancelado', function($codigo) {
    
    echo "Cancelado ".$codigo."\n";
});


$e->trigger('pedidoFinalizado', [4, 10]);