Level 102
Routes are cached in production anyways so I doubt there is any performance difference at all
1 like
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Currently I noticed all the routes are wrapped with a few middleware. My first thought was to move it to the global Middleware array in Kernel.php
And then I was curious: Is there any performance difference if you wrap around all your routes group:
// web.php
Route::group(['middleware' =>['auth', 'some_other_middleware']]), function () {
// all the routes
}
Routes are cached in production anyways so I doubt there is any performance difference at all
Please or to participate in this conversation.