How do I clear the cache using Laravel PHP?

Published January 17, 2022

Occasionally, after encountering the problem "I can't see my changes", you may need to make a lot of adjustments to your project configurations and views. Using Laravel, you can clear your cache from your command prompt if these changes fail to help. In this post, we will learn how to clear the cache using Laravel cache clear commands.

 Here is what we will discuss:

  • How The route cache can be cleared using Laravel commands

  • How to clear cache in Laravel apps

  • How to clean out the Laravel Config cache

  • How to clear Laravel view cache

  • How to reoptimize classes in Laravel using the artisan command prompt.

How to clear Cache using Laravel commands

You can use the following Laravel commands to clear your cache:

Clearing Route Cache: If you would like to remove the route cache  in Laravel,  then you should  use the following  command

php artisan route:cache

 

Clear cache in Laravel PHP

 

Clearing Laravel application cache: To clear the application cache  in Laravel,  simply run the command

 

php artisan cache: clear

 

Clear cache in Laravel PHP 2

 

 

Clear Config Cache: In Laravel, you may need to clean the configuration cache from time to time. To do this, use the following command

php artisan configuration:cache

 

Clear cache in Laravel PHP 3

Clear the Laravel view cache: To clear your view cache in Laravel, open a command line and use the following command

view:clear php artisan

 

 

Clear cache in Laravel PHP 4

 

Reoptimized Class: Class loaders may sometimes be the source of problems. To resolve these issues, use the following command to reoptimize your class loaders

optimize php artisan

 

Clear cache in Laravel PHP 5

 

That’s all about clearing cache in Laravel PHP

 

Download Source code

 

Article Contributed By :
https://www.rrtutors.com/site_assets/profile/assets/img/avataaars.svg

544 Views