Laravel Rust vs Laravel PHP: what changes, and when to switch
What stays the same, what's different day to day, what Laravel's own benchmark measured, and when moving from Laravel PHP to Laravel Rust is worth it.
- comparison
- php
- getting-started
On this page
Laravel describes Laravel Rust as Laravel “reimagined in idiomatic Rust”: the same conventions and built-in features, rebuilt around a compiler rather than ported line by line. If you’ve used Laravel PHP for years, most of it will feel familiar within a day. Most of what’s new is work the compiler now does for you.
What stays the same
- The shape of an app. Routes in a
webfile and anapifile, handlers grouped by resource (they do the job of controller methods), middleware, sessions, CSRF protection,.envfiles and anAPP_KEY. - The features. Validation, an ORM with relationships and eager loading, migrations, seeders and factories, queues, the scheduler, mail, notifications, broadcasting, cache, file storage, authentication and authorization. Laravel calls it “near feature parity” with Laravel PHP.
- The frontend. Inertia with React, Vue or Svelte, including deferred props, polling, prefetching and server-side rendering. Or server-rendered views, if you prefer.
- The command line.
laravel migrate,laravel route:list,laravel dev. Thelaravelcommand does the job ofphp artisan. - Laravel Cloud. It detects a Laravel Rust app and runs it, with managed queues and scale to zero.
What changes day to day
There’s a compile step
PHP runs your files as they are. Rust compiles the whole app into one binary first, with your migrations inside it. laravel dev rebuilds and restarts on save, so the loop is still “save, refresh”, just slower. You get something for the wait: mistakes that PHP reports at runtime, or never, stop the build.
More is checked before your code runs
A few things the compiler catches that Laravel PHP doesn’t:
- Column names in queries, and the types you compare them with.
- Links to routes. You build them from the handler function (
route!(orders::show, order.id)), not a route name string, so renaming a handler breaks the build instead of a link. - Forgotten authorization. Every validated input struct must declare who may submit it, or it doesn’t compile.
- Lazy loading. Relationships are never loaded behind your back. You load what a page needs with
with, so an N+1 query can’t creep in.
Mass assignment is part of the type
In Laravel PHP you guard a model with $fillable, and the form request lists rules separately:
class Payout extends Model
{
protected $fillable = ['account_holder', 'iban', 'amount'];
}
In Laravel Rust the validated input struct is also the list of columns a request may write:
#[laravel::input(fills = Payout)]
#[validate(authenticated)]
pub struct StorePayout {
#[validate(required, max_length(140))]
account_holder: String,
#[validate(required, max_length(34))]
iban: String,
#[validate(required, min_value(1))]
amount_cents: u32,
}
A client that adds status=paid to the request changes nothing, because the struct has no status field to fill.
Everything is async
Laravel Rust runs on Axum and Tokio. Database queries, HTTP calls, Redis, queues and S3 don’t block, so one slow third-party API call doesn’t hold up other requests. In handlers, that mostly means writing .await? after calls that do I/O.
Deploys ship a binary
Instead of copying PHP files and running Composer on the server, you build once (cargo build --release) and run the binary, next to public/, resources/views/ and storage/. There’s no PHP-FPM, OPcache or web server process to configure: the binary is the server.
What Laravel’s benchmark measured
Laravel published a benchmark that ran the same small API (a list of posts and a single post, backed by MySQL) in six frameworks on identical Laravel Cloud instances. The figures below are Laravel’s, from their posts:
| Measure | Laravel Rust | Laravel PHP |
|---|---|---|
| Best 10-second window without failures | 1,774 requests/s | 97 requests/s |
| CPU at a steady 50 requests/s | about 4% | about 52% |
| Median wake from scale-to-zero | 154 ms | 712 ms |
| Median cold build on Cloud | about 3 minutes | 27 seconds |
Two caveats come from the benchmark post itself: the test apps were intentionally simple, and results for more complex apps will differ. Read the full post for the method, the latency figures and the other frameworks tested.
When switching is worth it
Start a new app in Laravel Rust when:
- the app will handle a lot of traffic or long-lived connections, and the server bill or tail latency matters;
- you want the compiler to catch as much as possible, especially if coding agents write a lot of your code (Laravel built it with that in mind, and every new app ships with agent skills);
- you’re happy to learn Rust, or already know it.
Stay on Laravel PHP when:
- you have a working PHP app. Laravel has said plainly that Laravel PHP is not going into maintenance mode, and weekly releases continue. A rewrite needs a better reason than a benchmark;
- you depend on packages from the PHP ecosystem that have no Rust equivalent yet;
- you need a framework that’s already called stable. Laravel Rust is a beta; Laravel plans to call it stable after about six to eight weeks of feedback.
You can also split the difference: build the next new piece, such as a webhook receiver, an internal tool or a high-traffic API, in Laravel Rust, and keep the main app on PHP. Laravel Cloud runs both.
Quick reference
| Laravel PHP | Laravel Rust |
|---|---|
php artisan … |
laravel … |
| Controller method | Handler function in src/http/handlers/ |
FormRequest class |
#[laravel::input] struct with #[validate(...)] |
$fillable |
The fields of a fill struct |
route('orders.show', $id) |
route!(orders::show, id)? |
| Lazy loading | Not available: eager load with with |
| PHP-FPM behind a web server | One binary that serves HTTP itself |