How to Clear Cache in Laravel 8/7/6


How to Clear Cache in Laravel 8/7/6

Laravel is an open-source PHP framework used for building modern web applications. It is based on the popular Symphony framework and follows the model–view–controller (MVC) architectural pattern. Caching is a process to store copies of files at temporary storage and serve users on requests. It reduces the request processing time to enhance application performance.

Sometimes users face an issue that changes to the Laravel application are not reflecting on web interfaces. This happens due to the application is being served by the cached content.

This tutorial will help you to clear the cache in the Laravel application.

Clear Cache in Laravel (Terminal)

Log in to the system running your Laravel application and open a terminal. Then navigate to your Laravel application code. Here you can issue the commands to clear the cache as follows:

  1. Clear Application Cache

    Run the following command to clear the application cache of the Laravel application.

    php artisan cache:clear
  2. Clear Route Cache

    To clear the route cache of your Laravel application execute the following command from the shell.

    php artisan route:clear
  3. Clear Configuration Cache

    You can use config:clear to clear the config cache of the Laravel application.

    php artisan config:clear
  4. Clear Compiled Views Cache

    Also, you may need to clear compiled view files of your Laravel application. To clear compiled view files run the following command from the terminal.

    php artisan view:clear

Clear Cache in Laravel (Browser)

Most of the shared hosting providers don’t provide SSH access to the systems. In that case, you can clear the Laravel cache by calling the URL in the browser. You can simply place the below code in your routes/web.php file of the Laravel application. Then access this URL in the browser to clear the cache of the Laravel application.


This tutorial describes you delete cache in Laravel framework using command line and web browser.


Post a Comment