How to Clear Cache on Laravel 11|10|9

How to Clear Cache on Laravel 11|10|9

To clear all types of cache such as route, config, view, and app in laravel, Just open your command line or CMD and use the PHP Artisan command to clear cache from your Laravel application or project.

In Laravel project you can clear all types of cache by running the artisan command on cmd or command line and without using the artisan command.

How to Clear Cache from Laravel 11|10|9

Here are two options to clear route, app, config, and view cache in Laravel 11|10|9 project using artisan command on command lline or cmd:

Option 1 – Laravel Clear route, app, config, view cache using Command Line

Here are PHP artisan commands to delete or clear route, app, config, and view caches using artisan commands:

Laravel Clear Route Cache

Use the below command and clear your routes cache :

php artisan route:cache

Laravel Clear App Cache

Use the below command and clear your application cache like session cache, cookies cache:

php artisan cache:clear

Laravel Clear Config Cache

Use the below command and clear your config cache :

php artisan config:cache

Laravel Clear View Cache

Use the below command and clear your view (blade) cache :

php artisan view:clear

Laravel Clear Cache using Reoptimized Class

php artisan optimize

Solution 2 – Laravel Cache Clear using without Command

If you are unable to access SSH on shared hosting servers, there is an alternative method to clear the cache by modifying the route file. To do this, follow the steps below:

  1. Locate the web.php file in your project. This file is usually located in the routes directory.
  2. Open the web.php file in a text editor or an integrated development environment (IDE).
  3. Insert the following code snippet at the desired location within the file:
//Clear route cache:
Route::get('/route-cache', function() {
$exitCode = Artisan::call('route:cache');
return 'Routes cache cleared';

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

// Clear application cache:
Route::get('/clear-cache', function() {
$exitCode = Artisan::call('cache:clear');
return 'Application cache cleared';

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

Then save the changes to the web.php file.

Now, you can clear the cache of your application by accessing the /clear-cache URL in your web browser. For example, if your website URL is, you would visit

After accessing the URL, the cache of your application will be cleared, and you should see a message indicating successful cache clearance.

If the cache is not cleared yet. Then go to the bootstrap/cache directory. And delete all files and sub-directories inside the bootstrap/cache directory.

Or, you can execute the following on the terminal instead of manually deleting the file:

cd bootstrap/cache/
rm -rf *.php

Recommended Laravel Posts

Recommended:-Laravel Try Catch


Greetings, I'm Devendra Dode, a full-stack developer, entrepreneur, and the proud owner of My passion lies in crafting informative tutorials and offering valuable tips to assist fellow developers on their coding journey. Within my content, I cover a spectrum of technologies, including PHP, Python, JavaScript, jQuery, Laravel, Livewire, CodeIgniter, Node.js, Express.js, Vue.js, Angular.js, React.js, MySQL, MongoDB, REST APIs, Windows, XAMPP, Linux, Ubuntu, Amazon AWS, Composer, SEO, WordPress, SSL, and Bootstrap. Whether you're starting out or looking for advanced examples, I provide step-by-step guides and practical demonstrations to make your learning experience seamless. Let's explore the diverse realms of coding together.

Leave a Reply

Your email address will not be published. Required fields are marked *