What the F*ck Is With All the Artisan Commands: Route Commands
Last Updated: Feb 18, 2020
There are three route commands that we need to quickly cover in order to be completionist in this process of going over every artisan command.
Why It Exists
route:list allows you to view a listing of all the routes that have been defined in your application.
When Should You Use It
route:list is helpful for debugging when a route isn’t working and for seeing what’s available.
The defaults on the route:list command is extremely verbose. It’s so verbose that it doesn’t even fit into this post without you scrolling over to see it’s full output (sorry people on mobile). There is a --compact parameter that reduces the amount of information that’s displayed. You can also do this with the --columns parameter but this is a quick way to see some of the important pieces.
--method, --name, and --path
The route:list command also has --method, --name, and --path arguments which allow you to filter the output of the command on the method, name, and path of the route so it’s easier to digest.
The Route Cache
Laravel provides a couple caches but it provides two commands to cache your routes in order to improve performance.
The route:cache command allows you to clear and create the route cache.
The route:clear command allows you to just clear the route cache. This is a helpful command for when your routes aren’t working correctly and you need to troubleshoot them.
Hopefully this has been as helpful to you as it has to me. Check back soon for more artisan commands.
Scott is the Director of Technology at WeCare Connect where he strives to provide solutions for his customers needs. He's the father of two and can be found most weekends working on projects around his house with his loving partner.
Like this post? Don't forget to follow us on Twitter and Facebook for updates.