PHP code example of rollylni / triggers

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

    

rollylni / triggers example snippets



use Triggers;

function example(Triggers $trigg) {
    $trigg->handle("pre-loop");
    for ($i = 1; $i < 10; $i++) {
        $trigg->handle("looping", [$i]);
    }
    $trigg->handle("end-loop");
}

$trigg = new Triggers();
$trigg->add("pre-loop", function() {
    echo "starting loop!";
});

$trigg->add("looping", function($i) {
    echo "looping $i iteration!";
});

$trigg->add("end-loop", function() {
    echo "loop finished!";
});
example($trigg);