Home » Php » What is the best way to manage tons of routes efficiently in laravel web.php?

What is the best way to manage tons of routes efficiently in laravel web.php?

Posted by: admin February 25, 2020 Leave a comment

Questions:

I have many folders inside the routes and I decided to call them only when necessary like this:

if(\Request::is('test_route/*'))
{
    require __DIR__.'/backend/test_route.php';
}else if(\Request::is('test2_route/*'))
{
    require __DIR__.'/backend/test2_route.php';
 }`

Is this the best practice? Does it effect performance?
I’m confused if it increases performance?

How to&Answers: