Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Octane Laravel Package

laravel/octane

Laravel Octane supercharges Laravel by keeping your app in memory and serving requests via high-performance servers like FrankenPHP, RoadRunner, Swoole, and Open Swoole. Boot once, handle many requests fast for lower latency and higher throughput.

View on GitHub
Deep Wiki
Context7

Supercharge your Laravel application's performance.

Frequently asked questions about Octane
What Laravel versions does Octane support, and how do I check compatibility with my project?
Octane 2.x supports Laravel 10+ (LTS versions), while Octane 3.x targets Laravel 11+. Check your Laravel version with `php artisan --version` and ensure your `composer.json` aligns with the [Octane documentation](https://laravel.com/docs/octane#requirements). If using Laravel 9 or below, Octane isn’t compatible.
How do I install Octane, and which server (Swoole/RoadRunner/FrankenPHP) should I choose for my API?
Install via Composer: `composer require laravel/octane`. For APIs, **RoadRunner** or **FrankenPHP** are ideal—RoadRunner excels with async I/O, while FrankenPHP bundles Caddy for HTTP/2. Swoole is best for CPU-heavy workloads. Follow the [server-specific setup guides](https://laravel.com/docs/octane#installation).
Will Octane break my existing Laravel middleware or packages like Spatie’s Activity Log?
Most async-aware middleware works, but **synchronous middleware** (e.g., TrustProxies) may fail. Test with `Octane::concurrently()` and check if third-party packages (e.g., Spatie’s ActivityLog) support async contexts. Review the [troubleshooting section](https://laravel.com/docs/octane#middleware) for adjustments.
Can I use Octane in production without downtime, and how do I handle hot-reloading?
Yes, but deploy carefully. Use `--no-reload` in CI/CD to avoid conflicts, and exclude `vendor/` from watch lists. For zero-downtime updates, deploy to a new worker pool and switch traffic via a reverse proxy (e.g., Nginx). Monitor memory with `OCTANE_MAX_MEMORY` to prevent leaks.
How does Octane improve performance compared to PHP-FPM, and what benchmarks should I expect?
Octane reduces cold starts by booting Laravel once, then serving requests via in-memory workers, typically offering **2–10x higher throughput** and lower latency (P99). Benchmark your app with tools like [k6](https://k6.io/) or [wrk](https://github.com/wg/wrk) before/after migration. Expect ~50–200ms P99 for APIs under heavy load.
What are the risks of persistent database connections in Octane, and how do I configure them?
Persistent connections (e.g., `pdo_pgsql.persistent=1`) can leak resources. Configure `OCTANE_PERSISTENT_CONNECTIONS=false` or tune `OCTANE_MAX_MEMORY` to limit leaks. Use Eloquent’s `connection()->disconnect()` for long-running tasks, and monitor connection pools with `pg_stat_activity` (PostgreSQL) or `SHOW STATUS LIKE 'Threads_connected'` (MySQL).
Is Octane suitable for real-time apps (WebSockets, Pusher), or do I need additional setup?
Yes, Octane natively supports WebSockets via **Swoole** or **RoadRunner**. For Pusher, use the [Laravel Echo](https://laravel.com/docs/echo) with a WebSocket driver. Configure your server (e.g., Swoole’s `WebSocket` mode) and ensure your Laravel events are async-compatible. See the [WebSocket guide](https://laravel.com/docs/octane#websockets).
How do I debug Octane in development, especially async middleware or Swoole coroutines?
Use `Octane::concurrently()` to test async code, and profile with **Xdebug** or **Tideways**. For Swoole, enable `swoole.use_shortname=0` in `php.ini` and check logs with `OCTANE_LOG_LEVEL=debug`. Debug middleware by wrapping logic in `try-catch` blocks and logging errors to `storage/logs/octane.log`.
What’s the difference between FrankenPHP and RoadRunner, and which one should I pick for my Laravel app?
FrankenPHP bundles **Caddy** (HTTP/2) and PHP in a single process, ideal for simplicity. RoadRunner is a **worker pool** that requires a reverse proxy (e.g., Nginx) but offers finer control over workers. Choose FrankenPHP for ease, RoadRunner for flexibility (e.g., mixed PHP/Python workers). Benchmark both with your app’s traffic patterns.
Are there alternatives to Octane for Laravel performance, and when should I consider them?
Alternatives include **Laravel Forge + PHP-FPM tuning**, **Bref** (serverless), or **Swoole directly** (without Octane). Use Forge if you need managed hosting; Bref fits serverless APIs. Octane is best for **high-concurrency Laravel apps** where you control infrastructure. Avoid alternatives if you need **WebSocket support** or **async I/O**—Octane integrates these natively.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky
spatie/mailcoach-vapor
spatie/laravel-javascript-views