1. Go to this page and download the library: Download exan/eventer 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/ */
exan / eventer example snippets
class SomeEvent implements EventInterface {
public function __construct($myFirstArg, $mySecondArg)
{
}
public static function getEventName(): string
{
return 'Some Event';
}
public function filter(): bool
{
return true; // return false to skip execution
}
public function execute(): void
{
// Your event handling code
}
}
$eventer = new Eventer();
$eventer->register(SomeClass::class); // Listen to events regularly
$eventer->registerOnce(SomeClass::class); // Listen to a single event
$eventer->before(SomeClass::class); // Listen to events regularly, executed before events registered with `register`
$eventer->beforeOnce(SomeClass::class); // Listen to a single event, executed before events registered with `register`
$eventer->emit('Some Event', ['my first arg', 'my second arg']);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.