How To Clear Cache in Laravel 5 With Command Line

laravel clear cache

In this tutorial, we learn how to clear cache in laravel.

Cache type in laravel :-

1. application cache

2. route cache

3. config cache

4. complied view cache


1. Clear Application Cache

The below command used to clear the application cache of laravel application.

# php artisan cache:clear


2. Clear route cache

run the following command to clear route cache.

# php artisan route:cache


3. Clear Config Cache

To clear config cache on the laravel application you can use this below command.

# php artisan config:cache


4. Clear compiled view Cache

you can use php artisan view:clear command to clear compiled view cache.

# php artisan view:clear


Clear Cache laravel 5 on shared hosting:-

Some Shared hosting provider do not provide SSH (terminal). so you need to do one thing that pastes a below code on route/web.php file.


To clear route cache.  

//Clear Route cache:
    Route::get('/route-clear', function() {
    $exitCode = Artisan::call('route:clear');
    return '<h1>Route cache cleared</h1>';


To clear view cache.

//Clear View cache:
    Route::get('/view-clear', function() {
    $exitCode = Artisan::call('view:clear');
    return '<h1>View cache cleared</h1>';


To clear config cache.

//Clear Config cache:
    Route::get('/config-cache', function() {
    $exitCode = Artisan::call('config:cache');
    return '<h1>Clear Config cleared</h1>';

Save the file after pasting this code.


Now when you want to clear cache open this file on your favourite browser.

Clear cache on laravel


Blog type: 

Add new comment

Authored By

Sandeep Gurjar

Hy all, This is Sandeep Gurjar am the founder of I am a Redhat Certified Engineer (RHCE) / AWS Solutions Architect-Associate and working as an system administrator since 2016.

Follow us on

Facebook​  Twitter  LinkedIn  Google+