PHP code example of crcms / event
1. Go to this page and download the library: Download crcms/event 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/ */
crcms / event example snippets
$xslt
//first
$listener => ExampleListener1::class@listen
//second
$listener => ExampleListener2::class
//third
$listener => function($object) {
...
}
class ExampleListener1
{
public function listen($object)
{
...
}
}
class ExampleListener2
{
public function handle($object)
{
...
}
}
function($object) {
...
}
$xslt
class Example {
use CrCms\Event\HasEvents;
# Set events
public static function events() : array
{
return ['event1','event2'];
}
public function example()
{
# Trigger event
Example::fireEvent('event1',$listener);
}
}