PHP Classes

File: README.md

Recommend this page to a friend!
  Classes of Till Wehowski   Lazy PHP Event Handler   README.md   Download  
File: README.md
Role: Documentation
Content type: text/markdown
Description: Documentation
Class: Lazy PHP Event Handler
Register event handlers to be loaded dynamically
Author: By
Last change:
Date: 2 years ago
Size: 788 bytes
 

Contents

Class file image Download

event-module

Register EventHandlers in PHP to be lazy loaded.

Usage

Configuration

Set the directory to save the events in.

$my_directory =  __DIR__.\DIRECTORY_SEPARATOR.'compiled-events';
 \Webfan\App\EventModule::setBaseDir($my_directory);

### Register Events Register the events by your configuration/build script/process.

 \Webfan\App\EventModule::register('test', 'testing', static function($eventName, $emitter, \webfan\hps\Event $Event){
        print_r($Event->getArgument("testParam"));
});

### Call Events Dispatch the events later in a different script/process.

$event = new \webfan\hps\Event('testing');
$event->setArgument('testParam', 'testValue'); 
\Webfan\App\EventModule::action('test')->emit('testing', $event);