Laravel Artisan Route Command: The route:list Command
route:list command can be used to show a list of all the registered routes for the application. This command will display the domain, method, URI, name, action and middleware for the routes it includes in the generated table.
The following example demonstrates how to use the command without any options:
1php artisan route:list
It will generate a table similar to the following output (the exact table entries will depend on the registered routes).
The routes table can be filtered by using the various different options that the command defines. The following table lists and describes each of the various options the command supports. Some of the options support user supplied filters, which are denoted by the
<TERM> appearing in the options name. Replace
<TERM> with the value to filter by when running the command.
|Option Name||Description||Default Value|
||Filters the routes by method.||None|
||Filters the routes by name.||None|
||Filters the routes by path (URI).||None|
||Reverses the order the routes are displayed in the table.||None|
||Reverses the order the routes are displayed in the table (shortcut to
||The column to sort by. Accepted values are
The following examples demonstrate the effects of the various different options.
Filtering the routes by name:
1# Filter the route list by name.2php artisan route:list --name=account
Internally routes are filtered by checking to see if the search
<TERM> simply exists within the route's name, path or method; filtering does not support wildcard characters.
After the above command has executed, a table will be generated that only contains routes that have
account in the
This same process can be repeated for the
1# Filter the route list by URI.2php artisan route:list --path=account34# Filter the route list by method.5php artisan route:list --method=GET
The filters can be combined; results will be aggregated using "and" logic. The following command:
1php artisan route:list --path=account --method=GET
can be interpreted as "find all routes that contain
account in the URI and contain
GET in the method."
The following examples demonstrate how to call the command with the various other options:
1# Filter the routes and display them in reverse order.2php artisan route:list --method=GET --reverse34# The following is equivalent to the previous example.5php artisan route:list --method=GET -r67# Filter the routes and sort `name` column.8php artisan route:list --method=GET --sort=name
Thanks for taking the time to read this post! If you found this article useful and want to help support more work like this, please consider sponsoring my work on GitHub, or by checking out some merch.Sponsor on GitHub Shop Merch