PHP code example of walmsles / silverstripe-event-dispatch
1. Go to this page and download the library: Download walmsles/silverstripe-event-dispatch 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/ */
walmsles / silverstripe-event-dispatch example snippets
EventDispatcher::inst()->subscribe('myEvent', function($myData1, $myData2) {
// so somehting with $myData
return $myData1 . ' ' . $myData2;
});
/** @var array $responses */
$responses = EventDispatcher::inst()->dispatch('myEvent', array('event data', 'event data 2'));