PHP Classes

Lazy PHP Event Handler: Register event handlers to be loaded dynamically

Recommend this page to a friend!
  Info   View files Documentation   View files View files (14)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog (1)    
Last Updated Ratings Unique User Downloads Download Rankings
2021-11-06 (2 months ago) RSS 2.0 feedNot yet rated by the usersTotal: 53 All time: 10,119 This week: 35Up
Version License PHP version Categories
event-module 1.0.0MIT/X Consortium ...5PHP 5, Language
Description Author

This package can register event handlers that are loaded dynamically.

It can register event handlers with code from separate configuration PHP script files.

When the events are triggered, the package can load the handler dynamically and call it.

The package can also cache the compiled event handler code in PHP scripts to be loaded faster next time the respective is triggered.

Innovation Award
PHP Programming Innovation award nominee
November 2021
Number 2
Many applications need to execute tasks that can take some time to complete.

One way to process the results of those tasks is to use event handlers that register callback functions that the handlers invoke after the tasks are complete.

This package allows developers to configure event handlers from configuration scripts that are loaded dynamically. This possibility makes it possible to separate the task executing from the task processing using different PHP source code files.

Manuel Lemos
Picture of Till Wehowski
  Performance   Level  
Name: Till Wehowski <contact>
Classes: 27 packages by
Country: Germany Germany
Innovation award
Innovation award
Nominee: 9x

Details

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);
  Files folder image Files  
File Role Description
Files folder imageconfig (1 file)
Files folder imagesrc (2 directories)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file config.xml Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  config  
File Role Description
  Accessible without login Plain text file setDirectory.php Conf. Configuration script

  Files folder image Files  /  src  
File Role Description
Files folder imageWebfan (2 directories)
Files folder imagewebfan (1 directory)

  Files folder image Files  /  src  /  Webfan  
File Role Description
Files folder imageApp (2 files)
Files folder imageHomepagesystem (1 directory)

  Files folder image Files  /  src  /  Webfan  /  App  
File Role Description
  Accessible without login Plain text file EventModule.php Class Class source
  Accessible without login Plain text file EventModule2.php Class Class source

  Files folder image Files  /  src  /  Webfan  /  Homepagesystem  
File Role Description
Files folder imageEventFlow (3 files)

  Files folder image Files  /  src  /  Webfan  /  Homepagesystem  /  EventFlow  
File Role Description
  Accessible without login Plain text file State.php Class Class source
  Accessible without login Plain text file StateVM.php Class Class source
  Accessible without login Plain text file StateVM2.php Class Class source

  Files folder image Files  /  src  /  webfan  
File Role Description
Files folder imagehps (4 files)

  Files folder image Files  /  src  /  webfan  /  hps  
File Role Description
  Accessible without login Plain text file CodeSerializer.php Class Class source
  Accessible without login Plain text file EmitterInterface.php Class Class source
  Accessible without login Plain text file Event.php Class Class source
  Accessible without login Plain text file SerializeCode.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:53
This week:0
All time:10,119
This week:35Up
For more information send a message to info at phpclasses dot org.