PHP code example of bee4 / events
1. Go to this page and download the library: Download bee4/events 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/ */
bee4 / events example snippets
$vendor = new \Symfony\Component\EventDispatcher\EventDispatcher;
$adapter = new \Bee4\Events\Adapters\SymfonyEventDispatcherAdapter($vendor);
$adapter->on('name', function(EventInterface $event) {
echo "I have been triggered: ".PHP_EOL.print_r($event, true);
});
//EventImplementation must be defined in your project to suit your needs
//If must implements the `EventInterface` contract
$adapter->dispatch('name', new EventImplementation);