Try Sevalla today and get $50 free credit

Blog

Laravel performance benchmarks — PHP 8.2 vs 8.3 vs 8.4 vs 8.5

See how different PHP versions impact Laravel performance with our comprehensive benchmarks.

·by Joel Olawanle

Last month, Kinsta (the parent company of Sevalla) published a comprehensive set of PHP 8.5 performance benchmarks covering popular CMSs and frameworks, including Laravel. The analysis tested each platform under identical conditions across PHP 8.2, 8.3, 8.4, and 8.5 to show how performance changes across recent PHP versions.

The post sparked a lot of discussion in the PHP community. A recurring feedback was that simple “bare” benchmarks, such as hitting Laravel’s default / route, only tell part of the story. Developers want to understand how the numbers translate once real application concerns, like database access, authentication, and data transformation, enter the picture.

In response, we extended the original benchmark with a Laravel-focused test suite that covers two different workload types. The goal is to provide clearer context around how Laravel behaves across PHP 8.2 through 8.5 under both lightweight and more involved request paths. Below, we walk through the methodology and share the results.

Benchmark methodology

All benchmarks were run in identical, isolated environments to keep results comparable across PHP versions. Each Laravel setup ran in its own Docker container with the same configuration and no shared state between runs.

Environment details:

  • Host OS: Ubuntu 24.04 LTS
  • CPU / Memory: 30 vCPU, 120 GB RAM
  • Web server: nginx
  • PHP runtime: PHP-FPM (official php:<version>-fpm images)
  • Caching: OPcache enabled, JIT disabled
  • Database: MariaDB 10.11
  • Isolation: one container per PHP version and workload

No custom PHP-FPM tuning was applied. Memory limits, OPcache settings, and execution timeouts were kept at standard production defaults to avoid favoring any specific PHP version.

Requests were generated using ApacheBench (ab) with the same parameters for every test:

  • Concurrency: 15
  • Requests per run: 1,000
  • Runs per configuration: 5
  • Warm-up: 1 request before each run

Results are reported as requests per second (req/s). To reduce noise from cold starts and outliers, we use a trimmed average, dropping the lowest and highest run and averaging the remaining three.

We benchmarked two different request paths to reflect how performance changes as more application work is introduced.

The first is the default / welcome page. The second test targets an API endpoint at GET /api/products, protected using Laravel Sanctum. This endpoint validates input, authenticates the request, fetches a paginated set of 20 products via Eloquent with eager-loaded relationships, and transforms the result using API Resources before returning a JSON response.

Benchmark results

We started by benchmarking the default Laravel web entry point at /. This endpoint serves the framework’s welcome page and doesn’t involve authentication or database access, so it’s a good baseline for measuring framework overhead across PHP versions.

The response here is a full HTML page, approximately 80 KB in size, which reflects Laravel’s standard frontend output.

Laravel 12 default setup benchmark data

Across PHP 8.2 through 8.5, throughput stayed within a relatively narrow range. PHP 8.2 delivered the highest result at 730.11 req/s, followed closely by PHP 8.3 at 708.44 req/s, PHP 8.4 at 695.98 req/s, and PHP 8.5 at 700.33 req/s.

Laravel PHP benchmark results for default route

The differences between versions are modest, with no major regressions or step-change improvements as PHP versions advance.

After that, we moved on to the API endpoint at GET /api/products. Unlike the web route, this request utilizes more of the application stack, including token-based authentication via Laravel Sanctum, multiple Eloquent queries with eager-loaded relationships, pagination, validation, and JSON serialization through API Resources.

Laravel API endpoint benchmark data

As expected, throughput dropped compared to the web endpoint once database access and application logic were introduced. Additionally, despite handling more work per request, the API response is significantly smaller at approximately 6 KB of JSON.

Laravel API-focused PHP benchmark results

On this route, Laravel consistently handled between 425 and 445 req/s across PHP 8.2 to 8.5. PHP 8.3 produced the highest trimmed average at 444.82 req/s, with PHP 8.2 close behind at 437.31 req/s. PHP 8.4 and PHP 8.5 followed at 436.74 req/s and 425.67 req/s, respectively.

The relative spread between PHP versions remains small here as well. Once the request path is dominated by authentication, database queries, and serialization work, the PHP minor version plays a much smaller role in overall throughput than it does in the minimal web benchmark.

Note: Laravel’s performance characteristics can vary between framework versions. For example, separate checks using Laravel 10.x showed different relative performance patterns across PHP versions compared to Laravel 12.x. Performance conclusions should therefore always be tied to the specific Laravel version being tested.

Final thoughts

Across both request paths, the results show a consistent pattern. Minor PHP upgrades don’t dramatically change Laravel throughput on their own.

It’s also worth being clear about scope. These tests cover a couple of specific request paths in a controlled setup. They don’t represent every Laravel app. If your app has heavier queries, aggressive caching, queues, or external APIs in the mix, your results will look different.

The framework version also plays a role. Laravel’s internals and defaults change over time, and that affects performance.

The main takeaway is that PHP version matters, but it’s rarely the main limiter. How the app is built and how it’s run usually has a much bigger impact. These benchmarks are best used as reference points to help reason about performance, not as predictions for every production setup.

If you’re running Laravel in production, the environment matters just as much as the PHP version. Things like CPU availability, PHP worker limits, container isolation, and database performance often end up being the real constraints once an app moves beyond the simplest routes. Sevalla is designed for running application workloads like Laravel with containerized runtimes, managed databases, and predictable scaling.

For teams already thinking about performance, Sevalla is the kind of environment that lets Laravel behave consistently as the application grows. Sign up today and get $20 free credit.

Deep dive into the cloud!

Stake your claim on the Interwebz today with Sevalla's platform!
Deploy your application, database, or static site in minutes.

Get started