How to Clear cache in Laravel 8/7/6/5

Some times you face issues when any changes to the Laravel Application do not reflect in the web pages. This happens because many elements especially assets such as image, js, css, some configuration and even routes are served by the application cache. This post will help you to clear cache in the Laravel application.

Clear Cache in Laravel (Terminal)

Log in to the system running your Laravel application and open a terminal. Navigate to your Laravel application code root directory. You can issue the commands to clear cache as following:

1. Clear Application Cache

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

2. Clear route cache

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

3. Clear config cache

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

4. Clear compiled view files

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.

5. Clear them ALL

You can clear all cache, config, view, application, and all cache, using:

Results in:

Clear Cache in Laravel (Browser)

This is useful where you don’t have access to cli. For example, shared hosting providers don’t provide SSH access to the systems. In this case, you can clear Laravel cache by calling URL in the browser.

Simply create a new route in your routes/web.php routes file of your Laravel Application. You can hit this url in the browser to clear the cache of Laravel application.

Or more shortcut way(recommended)

The last one should result in:


It can be a good addition to your Laravel backend to call this url to clear all cache or create different urls called at a time. You can create a single with some checks. If you are a programmer I am sure you can figure that out easily :)

Leave a Reply