<?PHP
use Paxperscientiam\FlightRoutesFilter\FlightRouteFilterBuilder;
require "../vendor/autoload.php";
Flight::map("authRequired", function () {
echo "authRequired filter applied<br><br>";
exit;
});
Flight::map("derp", function () {
echo "derp filter applied<br><br>";
});
Flight::map("greetAbe", function () {
echo "Hi Abe!<br><br>";
});
Flight::map("curseMolluck", function () {
echo "Damn you Molluck!<br><br>";
});
$x = new FlightRouteFilterBuilder(Flight::app());
$x
->addBeforeFilter("/a", "derp")
->addBeforeFilter("/a", "authRequired")
->addBeforeFilter("/abe", "greetAbe")
->build();
Flight::route('/molluck', function () use ($x) {
s($x->getFilters()['applied']);
echo 'rendered';
});
Flight::route('/abe', function () use ($x) {
s($x->getFilters()['applied']);
echo 'rendered';
});
Flight::route('/a', function () use ($x) {
echo 'glad to be authorized';
});
Flight::map('error', function (Exception $ex) {
echo $ex->getTraceAsString();
});
Flight::start();
-
Notifications
You must be signed in to change notification settings - Fork 0
paxperscientiam/flight-routes-filter
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
No description, website, or topics provided.
Resources
Stars
Watchers
Forks
Packages 0
No packages published