Skip to the main content
{}
Back to all articles

Technical article

Core Web Vitals optimisation for Laravel projects

Investigate the causes of LCP, INP and CLS. Separate field data, lab tests and Laravel response time, then compare one focused change.

By Codegenie3 minute read
  • Performance
  • Core
  • Vitals
  • optimisation
  • Laravel
  • projects
Website preview with speed gauges and performance charts.
In this article

Core Web Vitals describe loading, responsiveness and visual stability. Field data comes from real usage; laboratory results come from a controlled run. A fast PHP response alone does not prove a fast complete page.

Measurement example: hold URL, viewport, device profile, network and date context constant. Investigate the largest visible element for loading delays. For shifts, inspect reserved space for images and later content. Repeat after one targeted change.

  • Report method and conditions with the result.
  • Separate field data, laboratory results and backend timing.
  • Do not promise rankings or fixed speed gains from a single score.

Improve Core Web Vitals by investigating the cause of a poor measurement: the LCP element, a slow interaction or an unexpected layout shift. Separate real-user field data from a laboratory test. A fast PHP response or green Lighthouse score does not prove that every visitor gets a fast page.

Measurement conditions and what the numbers mean

Google describes good values as LCP at most 2.5 seconds, INP at most 200 milliseconds and CLS at most 0.1, assessed at the 75th percentile and split by mobile and desktop. Without sufficient field data, the result is unknown. A lab test helps reproduce causes; Lighthouse Total Blocking Time is not a direct INP measurement.

Find the actual LCP element first

Use a trace to identify the element that becomes LCP. It may be an image or text. Investigate server waiting time, resource discovery and transfer, and delay before rendering. Do not lazy-load the LCP element. The retained responsive-image example aligns preload and img candidates and dimensions; preload only when the measurement justifies the early request.

Make the LCP image discoverable earlyresources/views/components/hero-image.blade.phphtml
<link
    rel="preload"
    as="image"
    href="/images/hero-1200.webp"
    imagesrcset="/images/hero-800.webp 800w, /images/hero-1200.webp 1200w"
    imagesizes="100vw"
>

<img
    src="/images/hero-1200.webp"
    srcset="/images/hero-800.webp 800w, /images/hero-1200.webp 1200w"
    sizes="100vw"
    width="1200"
    height="675"
    fetchpriority="high"
    alt=""
>

Investigate main-thread interaction work

Reproduce the click, tap or keyboard action with a suitable device profile. Separate input delay, processing and presentation delay. Reduce long JavaScript tasks and unnecessary handlers. Livewire or a server request does not automatically remove browser costs: provide prompt visual feedback and measure the actual interaction again.

Reserve space before content arrives

Identify shifted elements and their causes. Reserve image and embed space with dimensions or aspect ratio, avoid inserting unexpected banners above existing content and inspect font swaps. Include interactions and late content; one initial lab run does not cover an entire visit.

One bounded comparison

Illustrative scenario: JavaScript delays discovery of the hero image. Preserve URL, viewport, network profile and image candidate, make the image directly discoverable and repeat the trace. Check for duplicate downloads. This is an investigation method, not a measured Codegenie customer result.

Laravel caches are a separate backend step

In a Laravel application, configuration, route and view caching can support the server side. The explicit commands below are deployment steps, not a Core Web Vitals test. Use route:cache only if the routes support it; correct env calls outside configuration files first. Do not cache personalised HTML without proper user separation.

Cache framework metadata during deploymentdeploymentbash
php artisan config:cache
php artisan route:cache
php artisan view:cache

When is the improvement supported by evidence?

  • Compare the same URL, data, viewport, network and cache conditions before and after one change.
  • Assess LCP, INP and CLS separately and confirm the primary task still works.
  • Use repeated lab measurements for diagnosis and follow suitable field data over time.
  • Report missing data and the measurement method; a better score does not prove extra enquiries or ranking growth.

LCP, INP and CLS describe distinct browser problems. Connect each change to an observed cause and assess the whole page. Google uses Core Web Vitals in ranking systems, but good values guarantee neither a high position nor relevant content.

Last updated:

Need technical context for your own project?

Codegenie helps with Laravel applications, existing codebases, shared-hosting deployments and technical improvements.