Web Development
How to build a fast Laravel website that ranks
Speed affects both rankings and conversions. This is the Laravel set-up I use on client sites to keep pages quick on real phones, and the mistakes that slow most sites down.
A slow website costs you twice: visitors leave before it loads, and Google has less reason to rank it. I have built PHP and Laravel sites since 2010, and the fastest ones have never been the ones with the cleverest technology. They are the ones that load only what each page needs.
Render on the server
For a marketing site, Blade templates rendered on the server are the fastest starting point. The browser receives finished HTML it can show immediately, and search engines read the content without having to run JavaScript. I add interactivity with Alpine.js: menus, accordions, small forms. It is a few kilobytes and covers almost everything a business site needs.
Heavy single-page frameworks make sense for dashboards and tools. On a services site they usually add weight without adding anything a visitor notices.
Keep CSS and JavaScript lean
- Use Vite to bundle and version assets so browsers cache them safely.
- With Tailwind CSS, only the classes you actually use end up in the stylesheet.
- Load third-party scripts (chat widgets, heatmaps, extra pixels) only if they earn their place, and defer them.
- Host fonts sensibly, load only the weights you use, and preload the main one.
Handle images properly
Images are the most common reason a page fails Largest Contentful Paint. Resize uploads to the size they are displayed at, serve modern formats such as WebP or AVIF, always set width and height to stop layout shift, and lazy-load everything below the fold. The one exception is the main image at the top of the page: load that eagerly and give it high priority.
Cache what does not change
In production, cache config, routes and views, use OPcache, and cache expensive queries such as navigation menus or "latest posts" blocks. Check the database queries each page makes; a page running dozens of small queries in a loop is usually missing eager loading.
Build the SEO details in
Speed is one part of technical SEO. The others are just as easy to get right in Laravel when you plan for them:
- Editable meta title and description for every page, with sensible defaults
- One H1 per page and a logical heading structure
- Clean, readable URLs and 301 redirects when anything moves
- Canonical tags, an XML sitemap that updates itself and a robots.txt that points to it
- Structured data for your business, services, articles and authors
Test on a real phone
Lighthouse on a fast laptop flatters everyone. Test on a mid-range Android phone over mobile data, then watch the Core Web Vitals report in Search Console once real visitors arrive. That is the data Google uses.
What this looks like in practice
On one legacy migration, applying exactly these principles made the site three times faster and lifted its Lighthouse performance score to 96. The details are in the Laravel rebuild case study, and the full service is on my website development page.