How to clear cache using URL in Laravel

In this article we will Learn about how to clear cache using URL,I will show you how you can clear route:cache, config:cache, view:cache using URL.

This method is very helpful when you are using shared hosting, at that time going to the terminal and clearing cache from there is a very time taking process, so I will guide you on how you clear cache using URL in laravel.

To clear the cache using the URL go to your routes/web.php and add the below code into it.

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





    return "Cache is cleared...";


to run the above command go to your browser address tab and enter your domain-name/clear-cache.

The above command will clear cache,view,route and config.

If you want’s to clear all your cache in one command then use the below command in your terminal

php artisan optimize:clear

To clear composer run the below command

composer dump-autoload

To clear Route Run the below command

php artisan route:clear

To clear route cache, Run the below command

php artisan route:cache

To clear config cache, Run the below command

php artisan config:cache

To clear config,Run the below command

php artisan config:clear

Read Also: Laravel 6 Crud Application

I hope you like the above article,still confused feel free to comment.

Shaiv Roy

Hy Myself shaiv roy, I am a passionate blogger and love to share ideas among people, I am having good experience with laravel, vue js, react, flutter and doing website and app development work from last 7 years.

Related Articles

Leave a Reply

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

Back to top button