Laravel

How to Clear Cache in Laravel Without Using Artisan Commands

Ravindra Kumar

When working with Laravel, caching plays a key role in improving your application’s performance by storing compiled configurations, routes, views, and other data. However, during development or after making changes, you may need to clear the cache to see your latest updates.

Usually, developers use Artisan commands like php artisan cache:clear or php artisan optimize:clear. But what if you don’t have terminal access, or you want to clear cache manually?

This guide explains how to clear Laravel cache without any command, simply by deleting cache files from specific folders.

🗂️ Understanding Laravel’s Cache Locations

Laravel stores different types of cached data in various directories inside the storage and bootstrap folders. Here’s a quick overview:

Cache Type File Location
Application Cache storage/framework/cache/
Compiled Views storage/framework/views/
Sessions storage/framework/sessions/
Config Cache bootstrap/cache/config.php
Route Cache bootstrap/cache/routes.php
Event Cache bootstrap/cache/events.php

To clear the cache manually, you need to delete these files and folders safely.

🧾 Step-by-Step: Clear Cache Manually
1. Delete Cached Files

Using your File Manager or FTP client, open your Laravel project directory and navigate to:

storage/framework/cache/
storage/framework/views/
storage/framework/sessions/

Now, delete all files inside these folders (but do not delete the folders themselves).

If you’re using a terminal, you can run these commands:

rm -rf storage/framework/cache/*
rm -rf storage/framework/views/*
rm -rf storage/framework/sessions/*

2. Delete Config and Route Cache Files

Next, go to the bootstrap/cache directory and remove any cached files:

rm bootstrap/cache/config.php
rm bootstrap/cache/routes.php
rm bootstrap/cache/events.php

If you’re doing it via File Manager, simply delete those files manually.

Ravindra Kumar

Ravindra is a passionate full stack developer and dedicated blogger with a flair for crafting user-friendly web applications and insightful articles. With expertise spanning front-end and back-end technologies, Ravindra brings ideas to life through innovative coding solutions.

Suggested Reading

Upload (restore/import) a MySQL database backup via the command prompt (CLI)

To upload (restore/import) a MySQL database backup via the command prompt (CLI), you can use the mysql command-line utility. Here’s how: You must follow these requirement You must have a MySQL backup file (e.g., backup.sql) MySQL server should be installed and running You should have credentials for the MySQL user If you are working with […]

How to add new column in laravel migration without losing data

To add a new column in a Laravel migration without losing existing data, you can create a new migration file that alters the existing table. Laravel makes this easy using the php artisan make:migration command with the --table option. Step-by-Step Guide: You can generate a new migration Replace column_name with your desired column, and your_table_name […]

imagick php extension must be installed to use this driver in Laravel

It means that your Laravel app (or a package like Intervention Image, Spatie Media Library, or Laravel Snappy) is trying to use the Imagick image processing library, but it’s not installed or enabled on your server. If you’re using Ubuntu/Debian (Linux server): For PHP 8.1+, make sure you’re installing the correct version (e.g., php8.1-imagick). If […]

Attempt to read property “id” on null in Laravel

The error message “Attempt to read property ‘id’ on null” in Laravel typically occurs when you’re trying to access the id property of an object that is null. This commonly happens when you’re expecting an object to be returned (such as a database record), but instead, null is returned. You can handle this null value […]

How to check first record in Laravel blade file

Here’s how to check the first iteration in a Blade @foreach loop: You can use Laravel’s built-in $loop variable: Explanation: {{ $loop->first ? 'active' : '' }}: Adds the active class only to the first item. aria-selected="{{ $loop->first ? 'true' : 'false' }}": Ensures accessibility for tab behavior. Let me know if you also want […]

How to convert String to Lower and Upper case in Laravel blade file

In a Laravel Blade file, you can convert a string to lowercase or uppercase using PHP functions directly in the Blade syntax. Convert to Lowercase Use the strtolower() function: Convert to Uppercase Use the strtoupper() function: Using Laravel’s Str Helper Laravel provides a Str helper, which is more flexible: Lowercase using Str::lower() Uppercase using Str::upper() […]