Last July, I went on a quest to optimize laravelshift.com using Cloudflare services. I had been meaning to look into Cloudflare for a while. I just kept putting it off.
Being a web developer for over 25 years, I knew if I wanted to make my Laravel app fast, I should focus on page caching. Processing a request will always be slow. No matter how much you optimize the code. No matter how much you tune your database queries. The fastest way to process a request is to not process it at all.
This brought me back to Cloudflare, as caching responses is one of their main services. It's available on the free plan. And, even better, they don't just cache the response, they cache it at the edge. So, the response is even faster because it's served from a server geographically closer to you.
Unfortunately, when I finally researched caching pages for a Laravel app with Cloudflare, nothing worked. Well, one worked — but it was doing it all wrong. Initially I shared my findings in a tweet. When this received a (relatively) high number of views, I wrote an article for Laravel News.
Using this static middleware group provided a much better foundation. It explicitly registers cacheable routes and limits any footgun scenarios. But I still needed to make pages cacheable. While some pages are immediately cacheable (e.g. FAQ, Privacy Policy, etc), others need tiny refactors to make them cacheable.
As I continued on my quest to cache as many pages as possible, I used a number of different strategies. I continued to tweet my findings, write more Laravel news articles, even livestream. Yet it was clear I had a lot of content.
I haven't made a video course in a while. My last was Confident Laravel on writing tests for Laravel apps. I really only make courses when I feel there's a knowledge gap. This time, I felt there was a gap optimizing your Laravel app with Cloudflare services. So, I filled it with a new video course - Fast Laravel.
I went back and reviewed all the changes I made for laravelshift.com to take it from 6% cached to 99% cached. I organized them into this five-lesson video course, where we'll:
- Understand how caching works and how we'll use Cloudflare
- Optimize and cache assets that do not change
- Configure your Laravel app for caching pages
- Learn quick refactors to make pages cacheable
- Push even further with advanced caching strategies
By the end of the course, you'll have everything you need to improve the response times for your Laravel app — all using free services from Cloudflare.
I've already had multiple viewers tell me how much they learned from the course. One viewer reported updating their landing page to respond in 40ms! So, if you're looking to make your Laravel app fast, check out Fast Laravel.
What this course is not…
This course is not about code or database optimization. While those are ways to speed up your Laravel app, the course focuses specifically on caching responses with Cloudflare. As noted above, caching responses will always outperform lower-level optimizations.