Laravel PHP artisan Route List command
Ideally, the php artisan route:list
will display display the domain, method, URI, name, action and middleware for the routes it includes in the generated table.
Now, what if I want to show a route list for a particular url, name or method?
Well, in this case, we can use some Term in Artisan Route List.
The syntax of Article Route list is-
php artisan route:list --TERM=VALUE
List of Terms
--method
Filters the routes by method
--name
Filters the routes by name
--path=
Filters the routes by path (URI). None
--reverse
Reverses the order the routes are displayed in the table
-r
Reverses the order the routes are displayed in the table (shortcut to --reverse)
--sort
The column to sort by. Accepted values are host, method, uri, name, action or middleware
It will return the output as follows-
Some examples of the commands are-
# Filter the routes and display them in reverse order.
php artisan route:list --method=GET --reverse
# The following is equivalent to the previous example.
php artisan route:list --method=GET -r
# Filter the routes and sort `name` column.
php artisan route:list --method=GET --sort=name
Thank you.