phptorust

Laravel PHP to Laravel Rust, side by side.

Laravel Rust entered beta on 1 December 2026. This page puts the PHP you already write next to the Rust that replaces it. Point at, tap or focus a marked line to see its counterpart.

Laravel PHP

        
Laravel Rust

        

What stops being your job, and what becomes it.

Laravel PHPLaravel Rust
Loading relationships Touch $post->user and Eloquent runs the query for you, which is how N+1 queries sneak in. Relationships are never loaded behind your back. You ask for them up front with .with(Post::user).
Who may submit a form A form request can leave authorize() out and still run. An input struct has to declare who may submit it, such as #[validate(anyone)], or the code does not compile.
Mass assignment $fillable lists the columns a request is allowed to set. ..form fills only the fields declared on the input struct. Extra fields from the client are ignored.
Links to routes route('posts.show', $post) looks up a name at runtime. A typo fails when the page renders. route!(posts::show, &post) points at the handler function and is checked when you compile.
Column names in queries Strings: where('votes', '>', 100). Typed fields: Post::votes.gt(100). Names, operators and value types are checked by the compiler.
Migrations on the server Migration files ship with your source and run through php artisan migrate. Migrations compile into the application binary, so a server runs migrate without your source files.

Before you move anything.

  • It is a beta. The docs say releases before 1.0 may include breaking changes to APIs and configuration.
  • You need Rust 1.99 or later, plus Node.js and Git. Install Rust with rustup.
  • New apps default to PostgreSQL. SQLite and MySQL are a feature flag in Cargo.toml and two lines in .env.
  • The laravel command may already be taken. Herd and the Composer installer ship one too. Run laravel --version and check the output starts with Laravel CLI.
  • Community packages are days old. Spatie's ports are at 0.1.0 and Spatie says they are not stable releases yet.