Posts Learn Components new Snippets new Categories Tags About

How to Clear Cache in Laravel

Learn how to clear cache in Laravel 6/7/8 and get your route, views, configuration cleaned

Created on Jul 21, 2021


In this snippet, you'll learn how to clear Laravel Application Cache, Laravel Config Cache, Laravel Route Cache, and Laravel Compiled Views Cache.

Clear Application Cache

To clear your Laravel application cache you can run the command below.
php artisan cache:clear

Clear Configuration Cache

To clean your environment (.env) configuration cache, run the command below.
php artisan config:clear

Clear Route Cache

To clear all of your Laravel route cache you can run the command below.
php artisan route:clear

Clear Compiled Views Cache

To clear the compiled views cache that Laravel has rendered, you can run the command below.
php artisan view:clear

Extra: Clear Cache from Browser

Sometimes you might have no access (SSH) to the terminal in production. In this case, you can define a new web route to clear the cache.
# /routes/web.php


Route::get('/clear-all-cache', function () {

  return 'The application cache has been cleared';

If you like our tutorial, do make sure to support us with some coffee. We need the juice to write the content during the night 🤙🏻