Skip to content
Medium

Medium

Coding, Tutorials, News, UX, UI and much more related to development

blog.devgenius.io
MediumMedium
COMPUTING INFRASTRUCTURE AND HARDWARE

Laravel Rust: How Laravel Is Embracing Async, Performance, and a New Era of Backend Development

For years, Laravel has been one of the most productive ways to build modern backend applications with PHP. It gives developers an elegant syntax, a powerful ORM, built-in authentication, queues, events, notifications, testing tools, and almost everything needed to build a production-ready application. But what happens when you take that same philosophy and combine it with Rust? That is exactly what Laravel is exploring with Laravel Rust, a new full-stack web framework that brings Laravel’s conventions and developer experience to the Rust ecosystem. And there is one major architectural difference worth paying attention to: Laravel Rust is asynchronous by design. This is not simply Laravel PHP with a different syntax. It is a new framework built around Rust’s type system, compiled execution, and an asynchronous runtime. Let’s look at what has changed, why async matters, and what this could mean for backend developers. ### 1. Laravel Rust Is More Than a PHP Rewrite The first thing to understand is that Laravel Rust is not a port of the existing PHP framework. It is a new framework written in idiomatic Rust, designed to preserve the philosophy that made Laravel popular: developers should spend more time building applications and less time assembling infrastructure. It already includes many familiar building blocks: - Routing and middleware - Authentication and sessions - Database models and relationships - Migrations and query building - Typed validation - Queues and background jobs - Mail and notifications - Events and broadcasting - WebSockets - Durable workflows - Inertia support - Automated testing The framework is built on two important technologies: Axum handles the HTTP application layer, including routing and request handling. Tokio provides the asynchronous runtime responsible for scheduling tasks and managing non-blocking I/O. The combination gives Laravel Rust a foundation designed for high concurrency without sacrificing the structured development experience Laravel developers expect. The framework is currently in beta, so its APIs and ecosystem are still evolving. ### 2. The Biggest Difference: Async Is Built Into the Architecture To understand why this matters, let’s look at how a typical Laravel PHP application handles requests. ### The traditional PHP request lifecycle Consider a conventional Laravel controller: public function show(int $id) { $user = User::findOrFail($id); $response = Http::get( "https://api.example.com/users/{$id}" ); return response()->json([ 'user' => $user, 'external' => $response->json(), ]); } The application retrieves a user from the database, calls an external API, waits for the response, and then returns the result. In a conventional PHP-FPM deployment, the worker handling that request remains occupied while the synchronous operations complete. This model is perfectly capable of powering production applications. PHP has mature scaling strategies, including worker pools, queues, caching, and horizontal scaling. However, when an application spends a significant amount of time waiting for databases or external services, the number of concurrent requests it can handle becomes closely tied to the available workers and infrastructure. ### The Laravel Rust approach Laravel Rust uses asynchronous handlers. In Rust, an asynchronous function is declared using async, while .await marks an operation that may suspend until its result is available. For example: pub async fn store( Authenticated(user): Authenticated<User>, Valid(input): Valid<StorePost>, ) -> laravel::Result<Redirect> { let post = create!(Post { user: &user, ..input }).await?; Ok(redirect!(show, &post)) } Notice that the database operation is awaited. The important detail is what happens during that wait. Instead of blocking the runtime thread until the operation finishes, the asynchronous task can suspend. Tokio can then schedule other tasks on the available runtime threads. Imagine this sequence: 1. Request A starts a database query. 2. Request A suspends while waiting for the database. 3. Request B arrives and gets scheduled. 4. Request C performs an external HTTP request. 5. The database result for Request A becomes available. 6. Request A resumes execution. The runtime can keep making progress on other work while individual operations wait for I/O. This is the real advantage of async: better resource utilization when an application has many concurrent I/O-bound operations. It does not automatically make a single database query or HTTP request faster. It changes how efficiently the application handles waiting. ### 3. Async Concurrency: Doing More Than One Thing at a Time One of the most interesting parts of Laravel Rust is that asynchronous execution goes beyond simply adding .await to database queries. The framework also provides helpers for running independent operations concurrently. Imagine building an API endpoint that returns dashboard statistics. You need: - The total number of users. - The total number of orders. - The total number of payments. A sequential implementation would wait for each query before starting the next one. let users = db::table("users").count().await?; let orders = db::table("orders").count().await?; let payments = db::table("payments").count().await?; Each operation is asynchronous, but the queries are still executed one after another. Laravel Rust provides task::try_join! to execute independent asynchronous operations concurrently. use laravel::db; use laravel::prelude::*; use laravel::task; use serde_json::json; pub async fn show() -> laravel::Result<Json<serde_json::Value>> { let (users, orders) = task::try_join!( db::table("users").count(), db::table("orders").count(), )?; Ok(Json(json!({ "users": users, "orders": orders }))) } Instead of waiting for the first query to finish before starting the second, both operations can make progress concurrently. This is particularly useful for: - Analytics dashboards - API aggregation endpoints - External service integrations - Reporting systems - Applications that combine data from multiple sources The same module also provides other useful primitives: - task::select! to race competing asynchronous operations. - task::spawn_blocking to run blocking or CPU-intensive work outside the async execution threads. - task::background to schedule lightweight background tasks. This is where async becomes an architectural advantage rather than just a language feature. 1. HTTP Handlers Requests can suspend while waiting for I/O, allowing the runtime to process other tasks instead of keeping a thread occupied. 2. Database Queries Database operations can execute asynchronously without blocking the runtime’s execution threads. 3. HTTP Client External API calls can run concurrently, making it easier to integrate payment gateways, authentication providers, and third-party services. 4. Redis Cache operations use asynchronous I/O, helping applications retrieve and store data without unnecessarily blocking other tasks. 5. Queues Background jobs work with the asynchronous runtime, allowing applications to process tasks efficiently. 6. S3 and SQS Cloud storage and messaging operations can use asynchronous I/O when interacting with external services. 7. WebSockets Connections can be managed asynchronously, allowing applications to support real-time communication without requiring a dedicated blocking thread for every waiting connection. There is an important distinction here. Not every operation is naturally asynchronous. Password hashing, for example, is CPU-intensive. Local disk operations may also involve blocking APIs. Laravel Rust handles certain blocking operations by offloading them to Tokio’s blocking thread pool. This matters because running blocking work directly on an async runtime thread can prevent other tasks from making progress. The framework’s architecture is designed to keep those two execution models from interfering unnecessarily. ### 5. Durable Workflows: Beyond Traditional Background Jobs Laravel developers are already familiar with queues and background jobs. But Laravel Rust introduces another interesting concept: durable workflows. Consider a customer onboarding process: 1. A user creates an account. 2. The application sends a welcome email. 3. The workflow waits three days. 4. It checks whether the user has created a project. 5. If not, it sends additional onboarding information. With traditional queues, developers might implement this using delayed jobs, status columns, chained tasks, and scheduled commands. Laravel Rust allows developers to express this kind of process as an asynchronous workflow. use laravel::queue::Queueable; use laravel::time::ToSpan; use laravel::workflow::{Run, workflow}; #[derive(Queueable)] pub struct OnboardUser { pub user_id: i64, } #[workflow] impl OnboardUser { async fn handle(self, run: &Run) -> laravel::Result<()> { run.step( "send welcome email", self.send_welcome_email() ).await?; run.sleep(3.days()).await?; if run.step( "count projects", self.count_projects() ).await? == 0 { run.step( "send tips", self.send_tips() ).await?; } Ok(()) } } The interesting part is that the workflow can persist completed steps and resume execution after waiting periods or application restarts. A workflow waiting for three days does not need to occupy a worker during that entire period. It resumes when the next step is due. This is useful for: - Customer onboarding - Payment follow-ups - Subscription lifecycle management - Approval processes - Multi-step integrations - Long-running business operations It takes background processing beyond the simple concept of dispatching a job and waiting for it to finish. ### 6. Rust Brings Compile-Time Guarantees to Application Development Performance is only one part of the Laravel Rust story. Another major difference is Rust’s type system. In traditional Laravel PHP, developers rely on PHP types, validation rules, runtime checks, and tests to protect application behavior. Laravel Rust goes further by using Rust’s compiler to verify more aspects of an application before it runs. For example, request data can be described using a typed structure: use laravel::prelude::*; use crate::models::Post; #[laravel::input(fills = Post)] #[validate(authenticated)] pub struct StorePost { #[validate(required, max_length = 255)] pub title: String, #[validate(required)] pub body: String, } The framework uses this structure to define the expected input and its validation rules. There are several interesting guarantees: - Input structures explicitly declare authorization requirements. - Validation happens before the handler executes. - Model fields and relationships are represented through typed APIs. - Database column references can be checked at compile time. - Sensitive values can use dedicated types to reduce accidental exposure. For example, Laravel Rust provides Password and PasswordHash types to help prevent plain-text passwords and password hashes from being exposed accidentally in logs or serialized responses. This approach is particularly valuable in large applications where correctness and maintainability matter as much as raw performance. The compiler becomes another layer of protection. ### 7. What Do the Performance Numbers Actually Tell Us? Laravel’s announcement came with internal benchmarks comparing Laravel Rust and Laravel PHP. The headline figure is impressive: 1,774 requests per second for Laravel Rust versus 97 requests per second for Laravel PHP in the best qualifying 10-second window of the published test. The benchmark used a read-only workload, with the same application functionality and instance size, deployed on Laravel Cloud. At a steady load of 50 requests per second, the reported CPU usage was approximately: - Laravel Rust: 4.2% - Laravel PHP: 52.4% The benchmark also measured memory consumption, latency, build times, and wake-from-sleep performance. These figures are worth paying attention to, but they need context. The benchmark application was deliberately simple, with two read-oriented API endpoints and a small MySQL dataset. It was designed to compare framework overhead and throughput under a controlled workload. It does not mean every Laravel Rust application will automatically be 18 times faster than its PHP equivalent. Real-world performance depends on database queries, application logic, external dependencies, caching, hardware, and workload patterns. There is also a trade-off. Rust applications must be compiled. In the published Laravel Cloud benchmark, the median cold build time was approximately three minutes for Laravel Rust, compared with 27 seconds for Laravel PHP. Incremental local development builds were much faster, but compilation remains an important consideration. The lesson is simple: benchmark your actual workload rather than adopting a framework based on a headline number. ### 8. Should Laravel PHP Developers Move to Rust? Not necessarily. Laravel Rust is a new framework, currently in beta. Its ecosystem and production practices will need time to mature. An existing Laravel PHP application cannot simply switch runtimes and continue working unchanged. Moving to Laravel Rust may require: - Rewriting application logic in Rust. - Replacing or adapting PHP packages. - Learning ownership, borrowing, and lifetimes. - Updating deployment and build pipelines. - Adjusting testing and monitoring practices. - Training developers to work with asynchronous Rust. But this does not mean Laravel PHP is going away. Laravel’s creator has made it clear that Laravel PHP will continue to be developed. The two frameworks can serve different needs. Laravel PHP remains a mature choice for existing applications and teams with established PHP expertise. Laravel Rust may be worth evaluating for new services where high concurrency, resource efficiency, and compile-time guarantees are important. There is also an interesting possibility: using both frameworks within the same broader architecture, rather than treating the decision as an all-or-nothing migration. ### 9. What Should Developers Learn First? For developers coming from Laravel PHP, the learning curve is not just about understanding new framework APIs. It requires becoming comfortable with Rust itself. A practical learning path would look like this: 1. Learn Rust fundamentals Start with ownership, borrowing, lifetimes, structs, enums, traits, and error handling. 2. Understand async Rust Learn how async, .await, futures, and Tokio tasks work. Understand the difference between concurrency and parallelism. 3. Explore Laravel Rust conventions Study routing, middleware, models, typed validation, authentication, and database queries. 4. Understand concurrent operations Practice using task::try_join!, task::select!, and task::spawn_blocking. 5. Build a complete application Create a small API with authentication, database models, background jobs, and automated tests. 6. Learn production deployment Understand compilation, connection pools, observability, blocking operations, and resource management. The goal is not to become a Rust expert overnight. It is to understand enough of the language and runtime to build applications safely and efficiently. ### Conclusion: Laravel Is Expanding Its Definition of Backend Development Laravel Rust is an interesting evolution of the Laravel philosophy. It brings together the productivity of a batteries-included framework, the performance characteristics of compiled Rust applications, and an asynchronous architecture designed for modern backend workloads. The biggest change is not simply that Laravel now supports another language. It is that asynchronous execution becomes a foundation across the application stack. Database queries, external HTTP calls, queues, WebSockets, and concurrent tasks can all make progress without unnecessarily blocking the runtime. For developers, this opens a new way to think about backend architecture. Laravel PHP is not disappearing, and Laravel Rust is not an automatic replacement for every PHP application. But the introduction of a Rust-native framework gives developers another option when performance, concurrency, and compile-time safety become important requirements. The real question is no longer whether Laravel can embrace Rust. It is how far the Laravel philosophy can go when the language and runtime are no longer limited to PHP. --- Laravel Rust: How Laravel Is Embracing Async, Performance, and a New Era of Backend Development was originally published in Dev Genius on Medium, where people are continuing the conversation by highlighting and responding to this story.
LARAVEL RUSTLARAVEL
Laravelpackagist
MediumMedium
ARTIFICIAL INTELLIGENCE

Out of Claude Code quota? Finish the feature in OpenCode

curl -fsSL 'https://ivar.run/install?ref=claude-code-usage-limit-opencode' | sh ### The limit hits mid-feature When you hit the Claude Code usage limit halfway through a feature, switching model with /model does not get you further. Paid plans have a five-hour session limit and weekly limits, the weekly limits apply across all models, and Claude Code draws from the same pool as Claude chat (Anthropic: usage and length limits). /usage shows what counts against them (Anthropic: models, usage and limits in Claude Code). You can wait, enable usage credits, or keep working in another harness. A Claude Code feature request from June 2026 describes the cost of switching by hand: copying conversation summaries into a new session and re-explaining the codebase. OpenRouter’s tutorial keeps you in Claude Code and moves the bill to an API key. Hora de Codar asks the question this post answers: can the task be finished in OpenCode? It can, with one condition stated up front. The code is on disk; the conversation is not. A harness switch in ivar is a relay: a fresh session on the same feature, on the same branch and worktrees, under a different provider. Nothing from the Claude Code conversation carries over. What carries over is what the agent writes down in a handoff. ### Walkthrough The example feature is checkout-tax, promoted in an api and a web repo of an ivar hall at ~/acme. Commands, flags and messages below are from ivar 0.21.0. Setting up the hall is a one-time step covered in the quickstart; the hall has to list OpenCode as a provider, which the quickstart's ivar provider add covers. OpenCode needs a model provider of its own: your Claude subscription does not work there. Anthropic’s terms limit subscription sign-in to Claude Code and Claude.ai (The Register, February 2026). #### 1. Ask Claude Code to leave a handoff A handoff is a summary, pending tasks, open decisions and changed files, stored in the hall’s memory for the next session. The agent’s instructions tell it to open one when you wrap up, and also state that nothing opens a handoff for you. So ask for it while Claude Code still answers, for example once /usage shows the window nearly spent: I’m close to my usage limit. Leave a handoff so OpenCode can finish checkout-tax. The handoff is open for OpenCode sessions on checkout-tax: the tax line in the web cart and the api rate fixture are pending, and per-line versus per-order rounding is still open. To continue, run the relay below in a terminal at ~/acme. The handoff the agent wrote carries: summary: Tax rates load from the api; the web cart does not show them yet pending_tasks: Render the tax line in the web cart Add the rate fixture to the api tests open_decisions: Round per line or per order modified_files: api/src/tax/rates.ts web/src/cart/summary.tsx to.provider: opencode feature puts it in the feature's queue, and to.provider makes it visible only to OpenCode sessions. Handoffs expire after 7 days by default (memory.handoff_ttl_days in ivar.json). #### 2. Run the relay This is the one step you run yourself, because it starts a new harness process: OpenCode opens in your terminal, in place of the Claude Code session that is out of quota. Quit Claude Code first, then paste the command the agent gave you: ivar session start checkout-tax --relay --provider opencode \ --prompt "Read the open handoffs for this feature, then continue from the first pending task." --relay checks three things before it touches anything: - --provider, always. A relay exists to switch harnesses. - An earlier session on the feature. The Claude Code session counts as long as its view dir exists: quitting Claude Code leaves it in place, ivar session stop removes it. - A different provider from that session. Relaying checkout-tax to Claude Code again is refused with relay must switch provider; the most recent session on checkout-tax already ran claude-code . The new session gets a new view dir over the same promoted worktrees, OpenCode’s native files, and AGENTS.md built from the hall's HALL.md, the same rules Claude Code read as CLAUDE.md. --prompt is OpenCode's first message, so the session opens already working. Because ivar launches OpenCode itself, on Linux the OpenCode process runs under the same Landlock write sandbox a Claude Code session started this way gets. If Claude Code stopped before it could write a handoff, the relay works the same way. Put what is left in --prompt in your own words; the OpenCode agent then reads the changes already in the worktrees. #### 3. OpenCode picks the work up On Claude Code, a session-start hook runs ivar memory brief and prints the open handoffs before the first prompt. OpenCode has no such hook: its plugins cannot inject context at session start. The ivar MCP server's instructions tell the agent to call memory_handoff_list at session start instead, and the --prompt above makes that explicit: Read the open handoffs for this feature, then continue from the first pending task. I claimed the handoff from Claude Code. api and web are promoted on checkout-tax as it left them. Starting with the tax line in the web cart; rounding is still open, so I'll ask before I pick per line or per order. Check the first answer: the agent should name the pending tasks the handoff lists. Accepting the handoff claims it, so a later session does not pick it up again. #### 4. Close the Claude Code session Quitting Claude Code left its session record and view dir in place, which the relay needed. Once OpenCode is working, ask it to remove them: Stop the old Claude Code session on checkout-tax. The Claude Code session is stopped; this OpenCode session is the only one on checkout-tax. ivar session stop removes the view dir and ends any harness still running in it. Quit Claude Code yourself, as in step 2: two agents should never write into the same worktrees. It warns session.handoff_missing when a session worked and left no handoff, which happens when Claude Code stopped before step 1. The warning does not block the stop. ### Result The feature keeps going on the same branch, in the same worktrees, under OpenCode. The new agent starts from the handoff and the files on disk, with the same hall rules and skills. When the Claude Code window resets, the same relay with --provider claude-code moves it back. ### Limits - No conversation transfer. The relay is a new session. Reasoning that never made it into a file, a commit or the handoff is gone. - The relay is a command you run. It launches OpenCode as a new process in your terminal, which the Claude Code agent cannot do for you, and which it cannot do at all once it is out of quota. - OpenCode does not show handoffs on its own. The brief runs at session start on Claude Code, T3 and OMP. On OpenCode the agent has to call memory_handoff_list, which is why the relay passes --prompt. - The kernel sandbox needs the relay. The Landlock write sandbox applies only to a harness that ivar session start launches, on Linux 5.13 or later. Opening OpenCode by hand and attaching it with ivar session connect leaves only the tool guard hook, which checks the agent's tool calls but cannot see every write a shell command makes. On macOS there is no kernel sandbox either way. - Your Claude plan does not come along. OpenCode needs its own model provider or an API key, billed separately from the plan. If you want Claude specifically and pay per token anyway, the OpenRouter route keeps you in Claude Code. - A different model reads the work. Expect the new agent to re-read files before it edits them. - macOS and Linux only. For a single repo and a short task, writing the handoff into a Markdown file and opening OpenCode in the same directory gets you most of the way. The relay helps when the feature spans several repos and worktrees, which a new harness otherwise has to find again on its own. ### Related - Switch harness mid-feature: the short recipe. - Handoffs and messages: queues, addressing and expiry. - Relay to another harness: the session reference. - One MCP config for Claude Code, OpenCode and OMP: so the OpenCode session sees the same MCP servers. --- Out of Claude Code quota? Finish the feature in OpenCode was originally published in Dev Genius on Medium, where people are continuing the conversation by highlighting and responding to this story.
MAC OSLINUXOPEN CODECLAUDE CODE
InfoWorldO'Reilly Radar | SubstackAlsoBuilt