How to clear Laravel application cache by using artisan command? Here is how:


Laravel is caching several different part of application:

  • Routes
  • Config
  • Application
  • Views
  • Events and Listeners


In order to clear data from the cache you can use these commands:

                    php artisan route:cache // clear route cache
php artisan config:cache // clear config cache
php artisan cache:clear // clear application cache
php artisan view:clear // clear view cache
php artisan event:clear // clear all cached events and listeners


But there is another command which can clear all of these caches in one line, and that is:

                    php artisan optimize:clear

this single command will actually execute several different commands:

                    Cached events cleared!
Compiled views cleared!
Application cache cleared!
Route cache cleared!
Configuration cache cleared!
Compiled services and packages files removed!
Caches cleared successfully!


...easy peasy