How to show list of routes in Laravel


When your laravel application gets bigger, you will end-up having a lot of routes, and it's difficult to maintain, the ability to show list of routes probably will help you little bit to maintain the routes.

Luckily, in laravel we have a dedicated command line for showing list of routes, the good thing is you can search by name if your routes are using alias. 

The artisan command to show list of routes is different between laravel 4 and laravel 5.

Laravel 4
php artisan route
or
php artisan routes

Filter by name
You can filter by name (route alias) by adding --name parameter, here's an example:
php artisan route --name=home

Filter by path
You can also filter by path, if you just want to show routes with specific path, by adding --path parameter, here's an example:
php artisan route --path=home/login


Laravel 5
php artisan route:list
Filter by name
You can filter by name (route alias) by adding --name parameter just like on laravel 4, here's an example:
php artisan route:list --name=home

Filter by path
Same as laravel 4, you can also filter by path, by adding --path parameter, like this:
php artisan route:list --path=home/event/

Filter by method
With laravel 5, you can also filter by method of the routes, simply add --method parameter, here's an example:
php artisan route:list --method=GET


EmoticonEmoticon