modelslab/octane-coroutine
Adds coroutine support to Laravel Octane, letting you run concurrent PHP tasks inside Octane workers for faster I/O-bound requests. Integrates with Swoole coroutines, offers simple helpers for parallel execution, and helps reduce response times without changing your application structure.
refresh()/rebinding()/terminating() forwarding and after-response job dispatch are exactly the plumbing teams end up hand-rolling (and getting subtly wrong) during an Octane migration. Adopting this package replaces a custom, hard-to-test workaround with a maintained one.afterResponse() jobs firing on unrelated later requests, remember-me/basic auth intermittently failing, Cannot assign requested address under load — now have a concrete, low-risk remedy. If any of these are in the backlog, this release is the fix rather than a workaround.Adopt when:
terminate() callbacks executing repeatedly, after-response jobs or batches re-running, session-guard auth reading an empty request, or Redis connection errors at scale.Look elsewhere or wait when:
max_idle, max_idle_time, ping_after_idle, and max_lifetime defaults against your traffic profile before enabling.Rollout note for whoever owns deployment: the Redis pool ships default-off. Enable it behind a flag in staging, confirm connection counts and latency under real traffic, then roll forward. The callback fixes need no flag — they are corrections, and shipping them is the priority.
For executives: This release closes a set of production reliability defects that only surface after a service has been running for a while — degrading throughput, duplicated background jobs, and intermittent authentication failures on long-lived workers. Fixing them removes a recurring class of incidents that our dashboards are slow to attribute, because the symptoms are indistinguishable from ordinary load. It also adds an optional performance improvement that cuts Redis connections per request from 2 to 0.004, which reduces infrastructure pressure and removes a known cause of connection-refused outages under peak traffic. Cost is an upgrade and a staging validation window. Risk is low: the performance feature is opt-in and off by default, and the correctness fixes were verified across PHP 8.3/8.4 and Laravel 11/12/13, plus a production image under Swoole with nginx, showing no growing container state and flat throughput.
For engineering: Two things to internalise. First, the bug being fixed is architectural, not cosmetic: callbacks were being forwarded to the base application instead of the current request, so every request permanently added a callback to the worker, the session guard read the boot request rather than the live one, and terminate() executed every prior request's callbacks at the end of each subsequent request. Under Octane the Blade engine registers one such callback per request, so cost grew monotonically with worker age. The bus dispatcher had the same shape — request-scoped, but registering on the base app — which is why one afterResponse() dispatch produced 41 executions across 41 requests and now produces 1. Second, the Redis pool is a deliberate opt-in with conservative semantics: only provably clean phpredis sockets are reused, and a lease held past its request raises rather than silently sharing a socket. Tune max_idle, max_idle_time, ping_after_idle, and max_lifetime against observed traffic before enabling in production. Pin v0.8.37 in the lockfile — v0.8.36's tag-to-commit mapping on Packagist is stale, so a resolved 0.8.36 gets you the pre-fix code.
One-line summary for a status update: Mandatory upgrade for anyone on Octane — it stops worker state accumulating and background jobs duplicating — with an optional, safe-by-default Redis pooling win that takes per-request connections from 2.0 to 0.004. Pin v0.8.37.
How can I help you explore Laravel packages today?