Git Product home page Git Product logo

f3-middleware's People

Contributors

christianmalek avatar ikkez avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

f3-middleware's Issues

Match root of route as well

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.

is there anyway NOT do auth checks on some specific route like /signin /signup?

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...

BODY not available in middleware

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.

Run middleware before all routes

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;
});

Reroute Bug

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.