1. Go to this page and download the library: Download vladzimir/f3-relay 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/ */
vladzimir / f3-relay example snippets
use F3Relay\Relay;
$relay = Relay::instance();
// Register middleware for key "web"
$relay->pipe('web', [
static function () {
// return false to stop chain
return true;
}
]);
// Run chain
$relay->run('web');
use F3Relay\Relay;
use F3Relay\Matchers\MatcherPath;
use F3Relay\Matchers\MatcherHive;
$relay = Relay::instance();
$relay->pipe('web', [
new MatcherPath('/admin/*'),
new MatcherHive('VERB', 'GET'),
static function () {
// runs only if all matchers are true
return true;
}
], priority: 20);
use F3Relay\ControllerProxy;
ControllerProxy::install(
before: static function (array $params, object $controller, ?array $args): bool {
// return false to cancel route handling
return true;
},
after: static function (array $params, object $controller, ?array $args): void {
// post-processing
}
);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.