Laravel Octane

Boots your Laravel application once and keeps it resident in memory on Swoole, RoadRunner, or FrankenPHP for dramatically faster request handling.

Tool
Composer
vv2.19.1
4,036stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
89/100Excellent
Development Activity92
Maintenance92
Community72
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
79/100Good
Architecture84
Code Quality85
Innovation82
Learning Curve65

Laravel Octane is an official Laravel package that supercharges application performance by booting the app once and holding it in memory across requests, served by a high-performance application server — Swoole, RoadRunner, or FrankenPHP — instead of the traditional PHP-FPM model that re-bootstraps the framework on every request. This eliminates repeated container resolution, config loading, and service-provider registration overhead on each request.

Octane is operated primarily through artisan octane:start, octane:stop, octane:reload, and octane:status commands, and it provides guardrails and helper APIs (concurrent tasks, in-memory tables, tick/interval scheduling) to help developers write code that is safe to run in a long-lived worker process, where global/static state can otherwise leak between requests.

What You Get

  • artisan octane:start/stop/reload/status commands to run and manage the persistent application server
  • Support for three interchangeable server backends: Swoole, RoadRunner, and FrankenPHP
  • Concurrent task dispatch (Octane::concurrently()) for running multiple operations in parallel within a worker
  • In-memory Octane::table() storage shared across all requests in a worker for fast, ephemeral shared state
  • Tick and interval helpers for running recurring background work inside the long-lived process
  • Guardrails and documentation for avoiding memory leaks and state bleed between requests in a persistent-process model

Common Use Cases

  • Reducing per-request latency on high-traffic Laravel APIs by removing repeated framework bootstrap cost
  • Running Laravel behind Swoole or RoadRunner in containerized/Kubernetes deployments that need a persistent process model
  • Adding WebSocket or long-lived-connection features to a Laravel app via Swoole’s coroutine support
  • Running lightweight concurrent tasks (e.g. parallel API calls) inside a request without a separate queue worker

Under The Hood

Architecture: The core Worker.php and ApplicationFactory.php classes manage bootstrapping a single Laravel application instance and then repeatedly cloning/resetting request-scoped state (RequestContext.php) for each incoming request, so container bindings and providers aren’t re-resolved from scratch every time; OctaneServiceProvider.php wires this into Laravel’s normal service-provider lifecycle, and separate Swoole/, RoadRunner/, and FrankenPhp/ directories implement each backend’s specific process/event-loop integration behind a shared Contracts/ interface.

Tech Stack: Octane is pure PHP (~13,000 lines) and depends on Symfony’s Process component for spawning and managing the underlying server binaries; it does not bundle Swoole or RoadRunner themselves — those are installed separately (a PHP extension for Swoole, a standalone Go binary for RoadRunner) — keeping the Composer package itself lightweight while supporting three quite different runtime models.

Code Quality: The tests/ directory has 65+ files targeting exactly the failure modes a persistent-process model introduces — state bleeding between requests (AuthenticationFlushingTest, BindingStateTest, CacheArrayStateTest, BroadcastManagerStateTest) — which shows the team specifically hardened against the class of bugs Octane’s architecture makes possible. CI runs a tests workflow on every push, and the project follows Laravel’s own PSR-12-adjacent conventions and StyleCI enforcement.

API Design: Getting started is a single composer require plus php artisan octane:install, and the Octane::concurrently()/Octane::table() facades read like natural extensions of existing Laravel facades, but developers do need to internalize the persistent-process mental model (no relying on static state resetting between requests) which is a real, documented learning curve beyond typical Laravel packages.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search