Laravel Delete Cache Files Manually | Without Artisan Command

Laravel Delete Cache Files Manually | Without Artisan Command

Laravel deletes cache files manually. In this tutorial, you will learn how to delete cache files manually in Laravel apps with and without using artisan commands.

There are 3 methods available to clear the cache in Laravel app; you can delete or clear cache using the command line, manually and programmatically.

How to Clear Cache in Laravel Apps with and without using Artisan Command

Here are three methods to delete or clear cache from laravel application using artisan command, manually and programmatically:

Solution 1 – Laravel Clear route, app, config, and view cache using Artisan Command

Here are some commands to delete or clear all types of cache such as route, app, config, view cache in Laravel projects:

php artisan route:cache
php artisan cache:clear
php artisan config:cache
php artisan view:clear
php artisan optimize

Solution 2 – Laravel Clear Cache Without Artisan Command

If you do not access ssh on the shared hosting server, we can also clear the cache by typing the code in the root file. Go to your web.php file and add the following code to clear your application’s cache:

//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';

Solution 3 – Laravel Delete Cache Files Manually

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 *