1. Go to this page and download the library: Download montefuscolo/php-mediator 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/ */
montefuscolo / php-mediator example snippets
use montefuscolo/BaseMediator;
$mediator = new BaseMediator();
// Add callbacks to be called later
$mediator->add_action('my-channel', function() {
echo 'Hello World' . PHP_EOL;
});
$mediator->add_action('my-channel', function() {
echo 'Foo Bar' . PHP_EOL;
});
// ....
$mediator->run_actions('my-channel');
use montefuscolo/BaseMediator;
$mediator = new BaseMediator();
// Add callbacks to be called later
$mediator->add_filter('my-channel', function($n) {
return $n * 2;
});
$mediator->add_filter('my-channel', function($n) {
return $n * 3;
});
$mediator->add_filter('my-channel', function($n) {
return $n - 6;
});
// ....
echo $mediator->run_filters('my-channel', 1);
// >>> 0
shell
composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.