1. Go to this page and download the library: Download iceylan/eventor 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/ */
iceylan / eventor example snippets
use Iceylan\Eventor\ShouldDispatchEvents;
use Iceylan\Eventor\HasEvents;
class User implements ShouldDispatchEvents
{
use HasEvents;
}
// Example
$user = new User();
$user->on( 'registered', function()
{
return 'Sending welcome email.';
});
$user->on( 'registered', function()
{
return 'Logging registration.';
}, priority: 10 );
// Higher priority, runs first
$results = $user->trigger( 'registered' );
print_r($results);
use Iceylan\Eventor\HasEvents;
class Order
{
use HasEvents {
on as public addHook;
off as public removeHook;
trigger as public runHook;
}
}
$order = new Order();
$order->addHook( 'something.happened', function()
{
echo "something happened";
});
$order->runHook( 'something.happened' );
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.