We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

Create Laravel Case Middleware in phalcon php

Hi Guys.

I wanna to be create laravel case middleware. You know that laravel has a specific folder for middlewares that you can bind them to any route groups.

how do it works on phalcon php?

Hi I don't know Laravel but here you can use Middleware and group routes

Good luck

Hi I don't know Laravel but here you can use Middleware and group routes

Good luck

thanks for your tips, but can i bind middleware to route groups?

Hi I don't know Laravel but here you can use Middleware and group routes

Good luck

and also i forgot to explain that i use micro phalcon framework application. sorry about that.



32.2k
Accepted
answer

You can access from middleware to anything passing the Di conteiner like parameter

$app = new Phalcon\Mvc\Micro();

$app->before(
    function () use ($app) {
        // do what you want
    }
);