Last Updated | | Ratings | | Unique User Downloads | | Download Rankings |
2021-11-06 (2 months ago) | | Not yet rated by the users | | Total: 53 | | All time: 10,119 This week: 35 |
|
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
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 |
| |
|
|
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);
|
Applications that use this package |
|
No pages of applications that use this class were specified.
If you know an application of this package, send a message to the author to add a link here.