pushinbr/pam-octane
| Install | |
|---|---|
composer require pushinbr/pam-octane |
|
| Latest Version: | v1.4.0 |
| PHP: | ^8.4 |
| Laravel: | 12 · 13 |
| License: | Apache-2.0 |
| Last Updated: | Nov 11, 2026 |
| Links: | GitHub · Packagist |
Laravel Octane lifecycle, powered by Rust and Tokio.
Connect PAM's native HTTP transport to Octane while Octane keeps ownership of Laravel isolation and worker lifecycle.
Install · Commands · Features · Benchmark · Upgrading · How it works · Docs · Issues

Install
In any Laravel 12 or 13 application, with stock laravel/octane:
composer require laravel/octane pushinbr/pam-octane
php artisan octane:install --server=pam
php artisan octane:start
octane:install --server=pam finds the pam binary (PATH, the project root or ~/.local/bin) or, after confirmation, installs it with PAM's official install script, which verifies the release checksum. It then writes OCTANE_SERVER=pam to .env and publishes config/octane.php, exactly as for Octane's other servers. PAM runs on Linux and macOS; on Windows, run the application in WSL 2 or Docker.
Nothing else changes: Octane stays unmodified, and this package teaches its commands the pam server through its service provider.

Commands
php artisan octane:start --server=pam # or OCTANE_SERVER=pam in .env / config/octane.php
php artisan octane:reload --server=pam # zero-downtime: every worker is replaced make-before-break
php artisan octane:status --server=pam
php artisan octane:stop --server=pam
octane:start takes Octane's usual options: --host, --port, --workers, --task-workers, --max-requests, --watch and --poll. It runs a foreground pam start cluster, prints each request in local, and stops it on Ctrl+C, like the Swoole and FrankenPHP servers. Every command also runs as pam artisan octane:start and so on.
The PAM-managed commands of earlier releases keep working unchanged. They start a detached application under PAM's supervisor (pam ps, pam logs, pam monit):
pam octane:start # pam up artisan ... -- pam:octane
pam octane:status
pam octane:reload
pam octane:stop
Arguments of pam octane:start before -- go to the supervisor, arguments after it to the server.

Features
Every Octane feature works on PAM, including the ones Octane only offers on Swoole:
Octane::table(). Tables fromoctane.tableslive in shared memory: every worker sees the same rows, and the rows survive reloads and worker recycling. Values larger than their column throwValueTooLargeForColumnException, like Swoole.- The
octanecache store (Cache::store('octane'),Cache::interval()) is shared by every worker when task workers run, or withPAM_OCTANE_SHARED_CACHE=true. Octane::concurrently()and task dispatch run on PAM task workers:octane:start --task-workers=N(orauto, one per CPU). Task workers are opt-in; without them tasks run sequentially, as on RoadRunner and FrankenPHP.Octane::tick()and cache intervals run on the task workers.- Octane's request sandbox, lifecycle events and listeners, and the real
Laravel\Octane\Worker. - Static files from
public/(Vite builds,storage:link) with ETag,Rangeandoctane.static_file_headers. octane.max_execution_time: a request past it is answered504and its worker replaced, even when it blocks.- Zero-loss
octane:reloadand--max-requestsrecycling: PAM's master keeps every listening socket. - Uploads streamed to disk, so a 1 GB upload works with the default
memory_limit. --watch(Node and chokidar, like Octane's other servers).- PAM extras: the post-boot zygote (
PAM_PREFORK_BOOT=appboots Laravel once and forks every worker from it), the edge page cache served from Rust, route-aware worker pools, and PAM's live metrics (pam top).
Tested with laravel/octane 2.19 and 2.24 on Laravel 12 and 13: laravel/octane's own suite with the package installed (0 failures, every request and response cross-checked through the PAM client), Octane's 35 Swoole-only table and cache store tests ported to PAM tables, and an end-to-end run in a fresh application (install, start, a request, three reloads under load with no failed request, stop).

Benchmark
The same Laravel application on the four Octane servers, median of 5 rounds (push-in/octane-benchmarks@14e42fb, PAM 2.2.15):
| Requests per second | PAM | FrankenPHP | Swoole | RoadRunner |
|---|---|---|---|---|
| hello | 11,191 | 9,826 | 8,310 | 6,323 |
| json | 10,530 | 9,479 | 8,161 | 6,140 |
| db | 8,854 | 8,260 | 7,003 | 5,205 |
| view | 9,456 | 8,329 | 6,963 | 5,443 |
PAM has the highest median throughput on every endpoint (7 to 14 % above FrankenPHP) and the lowest median p99 on hello, json and view. FrankenPHP is steadier: its p99 stays within about 1.6 ms across rounds, while PAM's varies more between rounds, and on db FrankenPHP's p99 (12.77 ms) is lower than PAM's (14.48 ms); Swoole has the lowest db p99. The numbers only hold relative to each other on that machine; the repository has the raw output, the method and the scripts to run it on your own hardware.

Upgrading from 1.3
- No breaking changes:
pam octane:start|status|reload|stop,pam artisan pam:octane,PamOctane::table()and the configuration keep working. - New:
php artisan octane:start --server=pamand the rest of Octane's commands.laravel/octane#1188will not be merged into Octane: this package is the supported way to run Octane on PAM, and you do not need thepush-in/octanefork. Remove it fromcomposer.json(arepositoriesentry pointing at push-in/octane, orlaravel/octane: dev-2.x-pam) and require stocklaravel/octane ^2.19. Octane::table()now works on PAM with stock Octane, so code written for Swoole runs unchanged;PamOctane::table()remains available.- To switch an application from the PAM-managed commands, stop it with
pam octane:stop, setOCTANE_SERVER=pamand start it withphp artisan octane:start(under systemd, Supervisor or a container entrypoint). Both run the same server code. octane.serve_static_filesandoctane.static_file_headersare now honoured besides thepam-octane.*keys.octane:start --server=pamrequires PAM 2.2.15 or newer (it warns on older versions);pam self-updateupdates PAM.

How it works
PAM Octane connects PAM's native HTTP transport directly to Laravel Octane's worker. Octane continues to own application isolation, lifecycle events and request cleanup; PAM owns PHP Embed, networking, streaming, supervision and Tokio-powered infrastructure.
HTTP → PAM / Tokio → PamClient → Octane Worker → Laravel
HTTP ← PAM / Tokio ← PamClient ← Octane Worker ← Laravel
PAM already embeds PHP and provides a persistent native HTTP runtime. This package deliberately does not duplicate Octane's Laravel lifecycle. It adapts PAM's request and response objects to Octane's public Client contract and then uses the real Laravel\Octane\Worker. That gives an application:
- one warm Laravel application per worker;
- Octane's request sandbox and lifecycle events;
- PAM's bounded streaming and client backpressure;
- correct cookies, uploads,
HEAD, streamed and binary responses; - one safe Laravel execution slot per worker;
- normal Laravel package discovery and configuration.
| Role | Octane server adapter |
| Boundary | Octane remains the lifecycle authority; this is not a Laravel fork |

Configure
To customize limits, publish the small configuration file:
pam artisan vendor:publish --tag=pam-octane-config
Environment variables include:
PAM_HOST=127.0.0.1
PAM_PORT=8000
PAM_REQUEST_TIMEOUT_MS=30000 # default: octane.max_execution_time
PAM_MAX_BODY_BYTES=2097152
PAM_MAX_RESPONSE_BYTES=268435456
With PAM 2.2.13 or newer:
- Uploads are streamed to temporary files, like PHP-FPM: a 1 GB upload works with the default
memory_limit. PHP'supload_max_filesize,post_max_size,max_file_uploadsandupload_tmp_dirapply,is_uploaded_file()/move()work, and the files are deleted when the request ends.PAM_MAX_BODY_BYTESonly bounds bodies held in memory. - The request timeout follows Octane's
octane.max_execution_time(0disables it;PAM_REQUEST_TIMEOUT_MSoverrides it). A request past it is answered504 Gateway Timeout, even when the handler blocks, and its worker is replaced. octane:reloadand--max-requestsrecycling are make-before-break and drop no requests. With PAM 2.2.15 the PAM master keeps every listening socket and a replacement worker adopts it, so no listener with queued connections is ever closed: nonet.ipv4.tcp_migrate_reqsetting is needed.
With PAM 2.2.15 or newer:
- Post-boot zygote. On Linux,
pam octane:start(andphp artisan octane:startwithPAM_PREFORK_BOOT=app) boots Laravel once and forks every worker (new, recycled or replacing a crashed one) from the booted application: workers are ready in a few milliseconds and share the booted memory copy-on-write. Database and Redis connections opened while booting are closed before the fork; register\Pam\Fork::beforeFork()/\Pam\Fork::afterFork()for anything else to reset per process.PAM_PREFORK_BOOT=engineboots Laravel in every worker instead. - Edge page cache.
PAM_RESPONSE_CACHE=truelets PAM serve whole pages from Rust without entering PHP. Mark routes withPam\Octane\Http\Middleware\CacheResponse(aliaspam.cache:ttl,stale,tags...) and purge withPam::purge(),Pam::purgeUrl(),Pam::purgeAll()or thePurgesPageCachemodel trait. Requests withCookieorAuthorizationand responses that set cookies are never cached by default. - Tables, shared cache, tasks and ticks. Octane tables (
octane.tables) live in shared memory (Octane::table(),PamOctane::table()),--task-workers=NrunsOctane::concurrently(), task dispatch,Octane::tick()and cache intervals, and theoctanecache store is shared by every worker when task workers run.
Details for each: the package README in the PAM repository.
The readiness report against Laravel Octane's own test suite, Laravel 12 and 13, a real ecosystem app and a benchmark is in READINESS.md.
maxConcurrentRequests is intentionally fixed to 1 for Laravel. Framework managers and facades contain process-global mutable state. Scale safely with multiple supervised PAM workers instead of overriding that boundary.
Supervised clusters, route-aware worker pools, systemd, troubleshooting and the quality suite are in Production.

Compatibility
| PHP | Laravel | Octane |
|---|---|---|
| 8.5 (default) | 12.x | 2.19+ |
| 8.5 (default) | 13.x | 2.19+ |
| 8.4 (supported) | 12.x | 2.19+ |
| 8.4 (supported) | 13.x | 2.19+ |
PAM embeds its own PHP 8.5, so the server always runs on 8.5; the host PHP only runs php artisan. Octane's commands need the pcntl extension there, as for every Octane server.

Runtime capabilities
- generational reload, status, stop and control-plane health;
- route-aware worker pools with crash and memory isolation;
- cooperative Fiber scheduling and HTTP/Redis clients;
- isolated bounded PDO and process pools for blocking work;
- production response cache with tags, authenticated invalidation, collapse and stale-while-revalidate;
- bounded route metrics plus Pulse, Telescope and OpenTelemetry integration.

Support and repository model
Usage questions belong in PAM GitHub Discussions. Reproducible defects use the main PAM issue tracker, and vulnerabilities must use private GitHub Security Advisories as described in SECURITY.md.
PAM Octane is developed in packages/octane alongside the runtime so transport and lifecycle changes can be tested atomically. It remains an independent, optional Composer package: applications that do not use Laravel or Octane do not install it.

Docs
- Laravel on PAM
- Production: supervised cluster, worker pools, systemd, troubleshooting, quality
- Changelog
- Contributing

Part of the PAM ecosystem
PAM runs PHP natively on servers, desktops and phones. This repository is one piece of it.
| PAM | PAM Desktop | PAM Native | Ecosystem |
|---|---|---|---|
| the runtime and CLI | native desktop apps in PHP | native Android and iOS apps in PHP | every official package and plugin |
Docs: push-in.github.io/pam-docs · Issues
Apache License 2.0 · Made in Brazil by Pushin
Related Packages
Octane-style persistent worker for the Atom framework — boot the application onc...
MAAF Runtime Package - Worker-based execution with cached bootstrap and module-l...
Laravel Octane with Swoole Coroutine support for massive concurrency and non-blo...
Fast compiled PHP validation library: Laravel-compatible rule strings, native co...
Phyra — Run Laravel on Workerman. Fast, memory-safe, state-leak-aware, with a cr...
Version History
| Version | Released | PHP | License |
|---|---|---|---|
| v1.4.0 | ^8.4 | Apache-2.0 | |
| v1.3.0 | ^8.4 | Apache-2.0 | |
| v1.2.0 | ^8.4 | Apache-2.0 | |
| v1.1.0 | ^8.4 | Apache-2.0 | |
| v1.0.3 | ^8.4 | Apache-2.0 |