PHP code example of miguelsaddress / pesy

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

    

miguelsaddress / pesy example snippets


$handlersCentre = HandlersCentre::getWithHandlers(array(
    'TextFileDump' => new TextFileDumpSampleHandler(array("sample:*")),
    'OtherTextFileDump' => new TextFileDumpSampleHandler(array("another:path:*"))
));


$eventEmitter = new EventEmitter($handlersCentre->getList());

$e = new TestEvent();
$e->setPath("sample:path");
$e->addData("key1", "value1");
$e->addData("key2", array(1,2,3));
$eventEmitter->broadcast($e);

$e = new TestEvent();
$e->setPath("wontBeHandled");
$e->addData("wontAppear", "in text file");
$eventEmitter->broadcast($e);

$e = new TestEvent();
$e->setPath("another:path:like:this");
$e->addData("will appear", "in text file");
$eventEmitter->broadcast($e);