PHP code example of initphp / events

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

    

initphp / events example snippets



use \InitPHP\Events\Events;

Events::on('helloTrigger', function(){
    echo 'Hello World' . PHP_EOL;
}, 100);

Events::on('helloTrigger', function(){
    echo 'Hi, World' . PHP_EOL;
}, 99);

Events::trigger('helloTrigger');


use \InitPHP\Events\Events;

Events::on('helloTrigger', function($name, $myName){
    echo 'Hello ' . $name . '. I am ' . $myName . '.' . PHP_EOL;
}, 100);

Events::on('helloTrigger', function($name, $myName){
    echo 'Hi ' . $name . '. I am ' . $myName . '.' . PHP_EOL;
}, 99);

Events::trigger('helloTrigger', 'World', 'John');