How do I disable Laravel view cache?
Stefan Izdrail
Founder & Senior Architect · 2026-06-29
Title: Disabling Laravel View Caching for Improved Debugging Experience
Body:
Laravel is an incredibly powerful framework that makes it easy to develop web applications. However, occasionally, you might come across a situation where you need to disable view caching to better understand your application's behavior. This blog post aims at providing you with a comprehensive guide on how to do just that. We will discuss the purpose of view caching in Laravel, when it is necessary to disable it and the steps to achieve this goal.
Understanding View Caching
In Laravel, view caching is an optimization technique that improves your application's performance by storing pre-compiled views in a cache file. This enables you to serve up the same output for each request without having to recompile the same view at each call. However, sometimes, during debugging or when working on new features, disabling this caching feature can be useful to ensure accurate results and proper error management.When to Disable View Caching
You might want to disable Laravel's view cache under the following circumstances: 1. Debugging errors in your application: Sometimes, you may encounter an issue that only surfaces when a specific set of parameters is passed to a view or a component within it. In such situations, disabling the view caching can help you quickly locate and rectify the error by providing meaningful information about the line of code causing the problem. 2. Testing new features: As you work on new features and make changes in your application's codebase, you might need to ensure that the updated content is being displayed correctly. Disabling view caching can help you verify that your updates are reflected accurately in each request made.Disabling Laravel View Caching
Now let us go through the steps required to disable Laravel's view cache: 1. Stop the Laravel process if it is running, and navigate to your project's folder using the command line (terminal/cmd). 2. Change directories toapp/storage. In case you are working on a Vagrant shared folder, you may have to modify the path accordingly.
3. Remove the existing view cache by deleting the content of the directory views, using the following command:
rm -rf views/* (Remove all files and directories within "views" including their subdirectories)
4. Restart your Laravel application, and access the page containing the view cache issue you are trying to debug. Now, you should be able to see the error message pointing to its exact location in the source code of your file.