Closed HRankit closed 3 years ago
Hello, You can do it in the following way:
Create the Middleware folder inside the App
Create the middleware you need here you have the documentation to create it
http://www.slimframework.com/docs/v4/concepts/middleware.html
use App\Middleware\Auth;
->add(new Auth());
Yeap.
I'm working on this skeleton project.
In the meantime, you can do it step by step like @GoldraK says.
Also, I have another repo with some examples using Slim and Middlewares.
Create an Auth Middleware: https://github.com/maurobonfietti/rest-api-slim-php/blob/master/src/Middleware/Auth.php#L12
Using this Auth Middleware: https://github.com/maurobonfietti/rest-api-slim-php/blob/master/src/App/Routes.php#L22
Please add basic before and after middleware skeleton to the project. It'll help everyone a lot.