1. Go to this page and download the library: Download txiki/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/ */
txiki / events example snippets
class DummyClass{
public function myMethod($foo, $bar)
{
return 'Out '.$foo.' '.$bar;
}
}
$e->on('myevent', 'DummyClass::myMethod');
// return 'Out foo bar';
$result = $e->trigger('myevent',['foo', 'bar']);
$e->off('myevent');
$eventsTable = $e->table();
php
e Txiki\Events\Event;
$e = new Event();
$e->on('eventName', function($id){
return 'ok form '.$id;
});
$e->on('eventName1', function(){
return 'ok form 1';
});
$e->on('eventName2', function(){
return 'ok form 2';
});
// return 'ok form 999';
$result = $e->trigger('eventName', [999]);
// return 'ok form 1';
$result = $e->trigger('eventName1');
// return 'ok form 2';
$result = $e->trigger('eventName2');
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.