1. Go to this page and download the library: Download mhndev/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/ */
mhndev / event example snippets
Event::bind('order.payed',function($order){
//do some cool stuf here
});
class MyClass {
public function __invoke($order) {
//do something here
}
}
$myObject = new MyClass;
Event::bind('order.payed', $myObject($order));
// pass $order object as second argument
Event::trigger('order.payed', $order);