Nasrul Hazim Bin Mohamad

Manage Routes in Laravel


Assalamualiakum & Hi,

It’s obvious, if you’re working on a large application which have a lot of routes needed, you will absolutely need to manage your routes – for me mainly the web and API routes.

So here an example how I did – Create a helper to load multiple route in particular directory.

The second part basically just specify to which directories to load the routes.

Routes Directory Structure

Routes Directory Structure

This method inspired by Spatie – Laravel Collection Macros.

You may use macro as well to load multiple routes. It depends how you want to manage your routes. For me, this is good enough for me.