ikkez / f3-middleware Goto Github PK
View Code? Open in Web Editor NEWa middleware router for PHP Fat-Free-Framework
License: GNU General Public License v3.0
a middleware router for PHP Fat-Free-Framework
License: GNU General Public License v3.0
Currently, if given a
\Middleware::instance()->before('GET|POST /cms/**', function(\Base $f3, $params, $alias) {
dd($params);
});
The only route that does not get matched by the middleware is whatever.com/cms
, without anything after it. Even more so, even by adding
\Middleware::instance()->before('GET|POST /cms', function(\Base $f3, $params, $alias) {
dd($params);
});
does it not get detected. Please implement a fix for this.
Hi ,
is there anyway NOT do auth checks on some route like whitelist?
//not check auth routes
$f3->route('GET|POST /login','Controller\Admin->login_page');
$f3->route('GET|POST /forget','Controller\Admin->forget_page');
$f3->route('GET|POST /captcha','Controller\Admin->captcha');
//all other routes need auth check
$f3->route('GET|POST /','Controller\Admin->login');
$f3->route('GET|POST /user','Controller\User->index');
//and so on...
Hi,
The $f3->BODY
isn't available in the middleware, but in the following route.
Here's my code:
$mw->on("foo", "POST|PUT *", function (\Base $f3) {
echo var_dump($f3->get("BODY")); //null
return true;
});
if(!$mw->run("foo")){
return;
}
$f3->run();
edit: If I try to access $f3->BODY
in the beforeRoute()
method, it's there. But not in the middleware handler.
Hi,
I want to prepare the body for all routes before the route controller got instantiated and to do it only once I want to do this with your middleware. Is it possible to execute it for every route?
I tried following code but *
is an invalid routing pattern.
\Middleware::instance()->before("*", function (\Base $f3) {
echo "Middleware test";
return;
});
Please see middleware.php:97
$this->reroute(substr($this->f3['PATH'],0,-1). // line 97
Shouldn't it be like this?
$this->f3->reroute(substr($this->f3['PATH'],0,-1). // line 97
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.