Post

Why Did Laravel Turn to Rust After Years on PHP?

Why Did Laravel Turn to Rust After Years on PHP?

Introduction

For more than a decade, PHP and Laravel proved that developer happiness could outperform raw runtime speed in the market. Teams shipped startups, SaaS platforms, and enterprise portals in days because Laravel handled routing, authentication, queues, and database queries with minimal ceremony. So when Taylor Otwell and the Laravel team released Laravel Rust in public beta on December 1, 2026, it caught much of the web community off guard.

If Laravel on PHP worked well enough to power millions of applications for over a decade, why rebuild the framework philosophy in a strict, compiled systems language? The answer goes far deeper than chasing synthetic speed records—it sits at the intersection of cloud economics, asynchronous architecture, and how AI coding agents are changing the way software gets written.

In this post, you will learn what Laravel Rust actually is (and what it means for PHP), examine the exact RPS, RAM, and latency numbers behind the move, explore the architectural shift from request-per-boot PHP to async Rust, and understand when to choose each stack.


First, Clarifying the News: Expansion, Not Abandonment

Before diving into benchmarks, one misconception needs clearing up: Laravel is not deleting or abandoning PHP.

Laravel Rust is not a PHP-to-Rust transpiler, nor is it a replacement that leaves existing PHP codebases behind. It is a clean-slate, full-stack web framework written in idiomatic Rust on top of Tokio and Axum, designed to bring Laravel’s conventions and developer experience into the Rust ecosystem.

1
2
3
4
5
6
7
8
                   Laravel Philosophy
      (Routing, Auth, Queues, Models, DX, Conventions)
                 /                      \
                /                        \
     Laravel PHP                      Laravel Rust
 (Dynamic, rapid iteration,      (Tokio + Axum, single binary,
  Octane/FrankenPHP, huge         compile-time safety, 18x RPS,
   existing ecosystem)             built for AI guardrails)

Alongside the beta launch, Laravel Cloud expanded from a PHP-focused host into a polyglot platform supporting Rust, Go, Ruby on Rails, Django, and Node.js natively—complete with Cloud MCP (Model Context Protocol) integrations for AI coding tools.

Key Takeaway: Laravel is repositioning itself as a web development philosophy rather than a single-language wrapper. PHP remains the foundation for millions of live applications, while Rust becomes a first-class option for workloads that demand strict safety and high throughput.


Was Laravel PHP Really “the Slowest Framework”?

When Laravel published its official December 2026 benchmarks on Laravel Cloud, one headline number immediately circulated online: Laravel Rust achieved roughly 18× the throughput of Laravel PHP on identical hardware.

To understand whether Laravel PHP was truly “the slowest,” look at the exact comparison published by Laravel under a ramping, read-only API workload on identical 4 GiB Pro instances on Laravel Cloud:

Framework Language Peak Throughput (RPS) Peak RAM Usage p50 Latency p99 Latency Scale-to-Zero Wake
Laravel Rust Rust 1,774 RPS 179 MB (~16 MB steady) 65 ms 137 ms 154 ms
Rocket Rust 1,623 RPS 146 MB — — —
Beego Go 1,596 RPS 159 MB — — —
Ruby on Rails Ruby 253 RPS 252 MB — — —
Django Python 183 RPS 147 MB — — —
Laravel PHP PHP 97 RPS 481 MB (~134 MB steady) 1,995 ms 2,707 ms 712 ms

Why Those Numbers Look So Dramatic—and Why PHP Still Worked Fine

Looking at the table, standard Laravel PHP came in last in single-instance throughput (97 RPS) and highest in peak memory (481 MB). Yet two nuances matter when interpreting this:

  1. Standard PHP execution vs. persistent runtimes: Traditional PHP spins up isolated worker processes that consume significant baseline memory (~134 MB at steady state, climbing to 481 MB under load) and struggle when concurrency climbs past worker limits—causing p50 latency to spike to 1,995 ms. Persistent PHP runtimes like Laravel Octane and FrankenPHP close part of that gap by keeping the framework booted in memory, though they still cannot match compiled native async binaries.
  2. Most applications are not framework-bound: For typical SaaS dashboards, internal tools, and content platforms, 97 RPS on a single node (over 8 million requests per day) is plenty, and databases or third-party APIs usually become the bottleneck long before PHP does.

So if 97 RPS was good enough for years, why make the leap to 1,774 RPS?

Key Takeaway: Laravel PHP did trail Rails, Django, Go, and Rust in raw single-node cloud benchmarks, but raw speed alone wasn’t the catalyst—efficiency at scale and reliability in a new coding paradigm were.


Four Core Reasons Laravel Turned to Rust

1. The AI Coding Era Demands Compiler Guardrails

In his accompanying letter to the community, Taylor Otwell asked a pointed question: If AI coding agents are increasingly writing, refactoring, and maintaining application code, what happens to frameworks optimized primarily for human typing convenience?

Dynamic languages like PHP excel when a human developer wants minimal friction—no type annotations required, flexible arrays everywhere, and forgiving runtime behavior. However, those exact traits become liabilities when an AI agent generates hundreds of lines of code at once. Bugs hide in dynamic properties, mismatched array keys, or misspelled database columns until they explode in production.

Rust flips that equation:

  • Compile-time verification: If an AI agent hallucinates a column name, passes a nullable field where a string is required, or mishandles shared state across async tasks, the code simply refuses to compile.
  • Built-in agent workflows: Every new Laravel Rust application ships with built-in “agent skills” designed to guide coding assistants (such as Claude Code or Cursor) toward idiomatic, compiler-approved patterns.

2. Cloud Economics: 18× RPS and ~63% Less Peak RAM

Even when an app doesn’t “need” 1,700 RPS to survive, compute efficiency directly translates into cloud bills:

  • Memory density: Dropping peak RAM from 481 MB to 179 MB (and steady-state memory from ~134 MB down to ~16 MB) lets smaller containers handle traffic spikes without aggressive horizontal autoscaling.
  • Tail latency under load: Keeping p99 latency at 137 ms versus 2,707 ms under peak pressure prevents cascading timeouts during traffic surges.
  • Scale-to-zero responsiveness: Waking a compiled Rust binary in 154 ms (compared to 712 ms for PHP) makes serverless and scale-to-zero architectures viable even for latency-sensitive APIs.

3. Native Async and Durable Workflows

Traditional PHP follows a synchronous, blocking model per request. Long-lived connections (WebSockets), high-concurrency fan-out APIs, and multi-day background workflows require separate daemon architectures, queue workers, and careful process supervision.

Built on Tokio and Axum, Laravel Rust is asynchronous at its core:

  • HTTP handlers, database queries, mailers, and queues run non-blockingly within a single binary.
  • WebSocket broadcasting is integrated via a built-in Rust Reverb server.
  • Durable workflows can pause and span days without tying up active worker threads or memory.

4. Solving Rust’s “Ergonomics Gap” for New Projects

Before Laravel Rust, teams choosing Rust for web backends had to assemble their own stack piece by piece—picking Axum or Actix-web for routing, pairing it with SQLx or SeaORM, wiring custom session middleware, adding validation crates, and building queue workers from scratch.

Laravel Rust packages all of those decisions into one cohesive convention. For teams starting ambitious projects in 2027 who previously skipped Laravel solely because of PHP, Laravel Rust removes that barrier.

Key Takeaway: Rust gives Laravel compile-time safety for AI-assisted development, native async concurrency, and dramatic cloud resource savings—while Laravel gives Rust the cohesive full-stack structure it has long lacked.


Under the Hood: Dynamic Runtime Risk vs. Compile-Time Safety

To see why compiler guardrails matter in practice—especially when AI agents write database and validation logic—compare how dynamic patterns fail versus how Laravel Rust catches errors before deployment.

The Pitfall: Silent Failures in Dynamic Inputs and Queries

In loosely typed code, a typo in an incoming payload key or SQL column name passes syntax checks and waits silently for a user to hit that branch in production.

1
2
3
4
5
6
7
8
9
10
11
12
13
// ❌ Problematic pattern: Dynamic array keys and raw column strings
// Syntax is valid, but typos in 'emial' or 'full_name' only fail at runtime.
public function update(Request $request, int $id)
{
    $data = $request->all();

    DB::update(
        'UPDATE users SET full_name = ? WHERE id = ?',
        [$data['name'] ?? '', $id]
    );

    return redirect()->route('users.show', ['id' => $id]);
}

If the database column is actually name instead of full_name, or if a client omits a required field, static syntax checks won’t save you—you find out when an HTTP 500 hits your logs.

The Laravel Rust Approach: Typed Inputs and Compile-Time Queries

Now look at how Laravel Rust handles validation, routing, and SQL queries using Axum, Tokio, and compile-time checked macros (db::query!) while keeping Laravel’s familiar structure.

Prerequisites: Rust toolchain (rustup / cargo), PostgreSQL or SQLite configured for compile-time schema verification, and the Laravel Rust CLI (laravel).

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
use std::process::ExitCode;
use laravel::prelude::*;

// 1. Typed input struct: missing or invalid fields automatically yield HTTP 422
#[laravel::input]
struct UpdateProfile {
    name: Option<String>,
    email: String,
}

// 2. Async handler built natively on Axum + Tokio
async fn show_profile(request: Request) -> laravel::Result<impl IntoResponse> {
    let user_id = request.path_param::<i64>("id")?;

    // 3. Compile-time checked query macro: verifies SQL syntax and column types at build time
    let user = laravel::db::query!(
        "SELECT id, name, email FROM users WHERE id = ?",
        user_id
    )
    .fetch_optional()
    .await?;

    match user {
        Some(u) => Ok(Json(u)),
        None => Err(Error::not_found()),
    }
}

async fn update_profile(mut request: Request) -> laravel::Result<Redirect> {
    // Parse and validate request body against UpdateProfile; abort with 422 on failure
    let profile = request.parse::<UpdateProfile>()?.or_abort(422)?;

    laravel::db::query!(
        "UPDATE users SET name = ? WHERE email = ?",
        profile.name,
        profile.email
    )
    .execute()
    .await?;

    Ok(Redirect::route(show_profile, ()))
}

// 4. Expressive route registration mirroring Laravel PHP
fn web_routes(route: &mut Router) {
    route.get("/users/:id", show_profile);
    route.put("/users", update_profile);
}

// 5. Single-binary entry point
fn main() -> ExitCode {
    Application::configure()
        .with_routing(|routing, _| {
            routing.web(web_routes);
        })
        .run()
}

What happens at compile time and runtime:

  1. #[laravel::input]: Enforces strict deserialization and validation rules before your handler logic even touches profile.email.
  2. laravel::db::query!: Evaluates the SQL statement and parameter types against your schema during cargo build, catching missing columns, wrong parameter types, and SQL syntax errors before deployment—while binding parameters safely to prevent SQL injection.
  3. Zero-overhead binary: main() compiles into a standalone executable with no PHP-FPM pool or interpreter boot cycle required.

Expected behavior:

  • Invalid JSON or missing email returns an HTTP 422 Unprocessable Entity automatically.
  • Valid GET /users/42 queries run asynchronously on Tokio without blocking other requests, sustaining low latency (~65 ms p50 under heavy benchmark load).

Common Pitfalls and Trade-Offs to Watch Out For

Shifting from PHP to Rust is not a free lunch. Before rushing to rewrite everything, consider the real trade-offs surfaced in the beta release:

  • Dramatically slower cloud builds: Because Rust runs exhaustive type checking, borrow-checker analysis, and optimization passes, cold cloud builds in Laravel’s benchmarks took ~3 minutes for Laravel Rust compared to ~27 seconds for Laravel PHP. CI/CD caching becomes essential.
  • Steeper human learning curve: While AI agents handle Rust’s boilerplate well, human engineers still have to debug lifetime errors, async trait bounds, and compiler diagnostics when things go wrong.
  • Smaller third-party package ecosystem (for now): Laravel PHP has over a decade of community packages (Stripe, Cashier integrations, PDF generators, admin panels). Laravel Rust is in public beta, so expect fewer ready-made ecosystem packages early on.
  • Over-engineering simple apps: Rewriting a working 20-RPS CRUD dashboard in Rust adds build complexity for negligible user-facing benefit.

Decision Guide: When to Use Laravel PHP vs. Laravel Rust

Use this quick checklist when starting your next project:

Scenario Best Choice Why
Content sites, internal tools, rapid MVPs Laravel PHP Fastest build/deploy cycle (~27s), massive package ecosystem, effortless hiring
High-throughput APIs & microservices Laravel Rust ~18× higher RPS, 179 MB peak RAM, sub-150 ms p99 latency under heavy load
Scale-to-zero / serverless workloads Laravel Rust 154 ms cold wake time vs. 712 ms for PHP
Heavy AI-agent-authored codebases Laravel Rust Strict compiler guardrails catch agent mistakes before production
Real-time apps & long-running workflows Laravel Rust Native async Tokio runtime, built-in Reverb WebSockets, durable workflows
Existing mature Laravel PHP product Laravel PHP (+ Octane) Zero rewrite risk; Octane/FrankenPHP already boosts performance substantially

Next Steps

If you want to explore this transition hands-on without disrupting your current PHP workflow:

  1. Audit your bottlenecks first: Profile your existing Laravel PHP app—if database queries or external HTTP calls account for 90% of response time, switching languages won’t fix them.
  2. Test persistent PHP if you just need more speed: Try Laravel Octane or FrankenPHP on an existing PHP service before committing to a language change.
  3. Prototype one isolated service in Laravel Rust: Pick a high-concurrency API endpoint, webhook processor, or WebSocket service to test Rust’s build times, db::query! ergonomics, and AI-assisted workflows firsthand.

Conclusion

Laravel’s move into Rust isn’t an admission that PHP failed—it is recognition that the software landscape has changed. PHP enabled an entire generation of developers to build quickly because it optimized for human fingers on a keyboard. But in an era of tighter cloud efficiency expectations and AI agents writing substantial portions of our code, the compiler has become a crucial partner.

By pairing Rust’s safety, single-binary footprint, and async speed with Laravel’s cohesive conventions, Taylor Otwell ensured that the Laravel way of building web applications isn’t tied to a single runtime’s ceiling. Whether you stick with Laravel PHP for rapid product iteration or reach for Laravel Rust for high-throughput, compiler-guarded systems, you now have both tools under one roof.


Suggested Reading

  • Laravel Official Site & Blog – https://laravel.com
  • The Rust Programming Language (Official Book) – https://doc.rust-lang.org/book/
  • Tokio Asynchronous Runtime Documentation – https://tokio.rs/tokio/tutorial
  • Axum Web Framework Documentation (docs.rs) – https://docs.rs/axum/latest/axum/
  • PHP Official Documentation – https://www.php.net/docs.php
  • Wikipedia: Rust (Programming Language) – https://en.wikipedia.org/wiki/Rust_(programming_language)

This post is licensed under CC BY 4.0 by the author.