1. Go to this page and download the library: Download carloscarucce/php-triggers 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/ */
carloscarucce / php-triggers example snippets
use PhpTriggers\Event;
use PhpTriggers\EventListener;
class MyListener extends EventListener
{
public function listen(Event $event, ...$data)
{
list($name, $lastName) = $data;
echo "Welcome $name $lastName !";
}
public function __construct()
{
$this->listensTo('check-in');
}
}
$listener = new MyListener();
$listener->register();