Don't cache routes or views locally

Great for production, but trouble for development

Joel Clermont
Joel Clermont
2023-12-26

Recently I was helping someone debug a weird issue and I discovered that they had run artisan route:cache and artisan view:cache in their local development environment. This wasn't the cause of their strange issue, but it definitely complicated debugging it.

There is no practical benefit to caching locally. It only gets in the way. In fact, when I asked this dev why they did it, they didn't really have a reason. It was just a habit they did without questioning it.

Route and view caching is a performance optimization that makes sense in production, but just adds complexity to development. You have to be constantly clearing or re-caching any time you make a change, which is very annoying.

Much better to just skip that step and avoid the headaches.

Here to help,

Joel

P.S. We recently launched a new website explaining how we work with Laravel teams.

Toss a coin in the jar if you found this helpful.
Want a tip like this in your inbox every weekday? Sign up below 👇🏼

Level up your Laravel skills!

Each 2-minute email has real-world advice you can use.