Clear all kinds of caches with a single command in Laravel
There are mainly three kinds of caches in Laravel that you need to clear all the related junk files and optimize the performance of the application.
Individually clearing caches
Here are all the caches and their related artisan command to clear them up.
- To flush the application cache
$ php artisan cache:clear
- To flush the route cache file
$ php artisan route:clear
- To flush the configuration cache file
$ php artisan config:clear
These commands are fine but I recently got to know about a command that can do all these single-handedly. Thanks to this tweet by Andrew Schmelyun!
One command fits all!
optimize:clear artisan command that can flush/remove the application cache, route cache, and config cache altogether.
$ php artisan optimize:clear
So, if you’re going to remove all the caches and don’t want to do it individually, you can use this command happily!
Like this article? Consider leaving aTip