Weave 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

Laravel S Laravel Package

hhxsv5/laravel-s

LaravelS is a high-performance adapter that integrates Swoole with Laravel and Lumen, enabling coroutine-based, resident-memory HTTP/WebSocket/TCP/UDP servers, async tasks, connection pooling, and hot reload. It boosts throughput and lowers latency for existing Laravel apps with minimal code changes...

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit. LaravelS is not a conventional Composer library that extends application behavior — it is a runtime adapter that replaces PHP-FPM with a resident Swoole/OpenSwoole HTTP server. It boots Laravel/Lumen once per worker and multiplexes many requests from that booted state. This is a critical distinction for TPM evaluation: the integration surface is infrastructure, deployment topology, and application state discipline, not a service provider's registration hooks. Fit is therefore strongest where the organization controls its own container images or VM fleet and can install the Swoole extension; it is essentially a non-starter on managed PHP platforms, shared hosting, or serverless runtimes where native extensions cannot be compiled and long-lived processes cannot persist.

Integration feasibility. The mechanical path is genuinely low-friction: composer require hhxsv5/laravel-s, php artisan laravels publish, php bin/laravels start. Auto-discovery means an existing Laravel app can be benchmarked behind nginx with no code changes whatsoever, which is an unusually cheap proof-of-concept for an infrastructure swap. The feasibility risk is not installation — it is the resident-worker contract. Any reliance on per-request isolation through singletons, static properties, $GLOBALS, config mutations, Auth guard state, locale settings, or cached per-user data in container singletons becomes a cross-request leakage hazard. This is the dominant cost driver and it is invisible in a short smoke test; it surfaces under production traffic as intermittent, hard-to-reproduce data bleed. Feasibility is therefore a function of dependency-tree hygiene, not of the package itself.

Technical risk. Four risk clusters a TPM should track explicitly. First, state-leak risk: the framework no longer resets between requests, and the CleanerInterface hook is a manual mitigation, not a safety net — it resets only what an engineer remembered to register. Second, blocking-I/O risk: a single synchronous outbound call stalls the entire worker for every concurrent user assigned to it, converting a previously localized latency issue into a throughput cliff. Third, connection-staleness risk: long-lived workers accumulate stale database and cache connections ("MySQL server has gone away"), mitigated imperfectly by max_request recycling, DB::reconnect(), or coroutine connection pooling. Fourth, debuggability risk: dd(), dump(), echo, header(), setcookie(), and output buffering all behave incorrectly or silently — output lands in worker stdout rather than the response — which degrades incident response and raises the on-call skill floor. The v3.8.8 patch itself is low-risk but carries a specific upgrade hazard: the added return-type declaration on configure() will fatal any subclass override lacking a compatible return type, so custom handlers, tables, tasks, and server extensions must be grepped before the bump.

Key questions.

  • Which specific service are we piloting, and what is its measured p95 latency and instance count today as a baseline?
  • Has the dependency tree been audited for packages that assume fresh-process semantics? What fraction of the transitive dependency set does that represent?
  • Does the team have anyone who can debug a long-lived worker — memory growth, stale connections, coroutine-context bugs — or is this a new capability we are funding?
  • Why LaravelS rather than Octane for anything greenfield? The comparison must be documented, since Octane is vendor-maintained and offers a RoadRunner/FrankenPHP exit ramp.
  • What is the rollback story if the pilot fails — is PHP-FPM retained in the deployment configuration as a fallback path?
  • Do we need WebSocket, timers, or async tasks? These bundled capabilities are the strongest remaining differentiator versus Octane and materially change the value calculus.

Integration Approach

Stack fit. LaravelS targets the Laravel 5.x–10.x and Lumen era and requires PHP 7.2+ plus the swoole (4.x+) or openswoole extension compiled and enabled. It is a complement to, not a replacement for, the existing web tier: nginx remains in front as a reverse proxy providing TLS termination, static asset serving, and caching headers, with an upstream pointed at the Swoole listen port (default 127.0.0.1:5200) and keepalive enabled. Swoole's own enable_static_handler is dev-convenience only and should be disabled in production to keep workers free. The fit is clean for high-traffic JSON APIs, internal services with spiky load, and real-time endpoints; it is poor for low-traffic admin panels where the operational overhead buys nothing.

Migration path. Adopt an explicitly staged approach rather than a flag-day cutover.

  1. Baseline. Run the unmodified application behind php bin/laravels start in a non-production environment and confirm functional parity with the existing PHP-FPM deployment. No code changes at this stage.
  2. Benchmark. Measure a representative JSON endpoint for throughput and p95/p99 latency against the PHP-FPM baseline, and record per-instance RSS to establish the memory scaling curve. This is the data that justifies or kills the program.
  3. Audit. Grep for configure() overrides (the v3.8.8 hazard), enumerate singletons and static caches, identify synchronous outbound I/O, and confirm container write access to the storage/ pid-file path — a known friction point for non-root containers.
  4. Harden. Implement CleanerInterface classes for every piece of unavoidable global state, set max_request to a few thousand to bound memory creep, disable opcache.validate_timestamps in production, and wrap WebSocket onMessage bodies in try/catch since an uncaught exception can drop every connection the worker owns.
  5. Pilot. Shift a bounded slice of production traffic. Keep PHP-FPM configured as the rollback path.

Only after this baseline should the team reach for WebSockets, task workers, or timers — treating those as separate, additional adoption decisions rather than part of the initial runtime swap.

Compatibility. Three compatibility layers need independent verification. Framework version: confirm the app's Laravel/Lumen version is within the supported era. Extension: verify php -m | grep -i swoole in every target image, and pin the Swoole/OpenSwoole major version, since coroutine behavior and API surface differ. Dependency tree: this is the highest-variance item. Packages that read superglobals directly, cache in statics, or assume per-request container resolution must be individually audited. A useful gate is a concurrency regression suite that issues interleaved requests carrying distinct user identity, locale, and auth state under load, then asserts no bleed-through.

Sequencing. The dependency order matters. Extension availability in base images must land first, since it gates everything downstream. Dependency auditing should run in parallel with benchmarking, not after, because a disqualifying finding there should stop the program before hardening effort is spent. Hardening and cleaner implementation precede any production traffic. Coroutines should be treated as a separate, later phase entirely — enable_coroutine => true changes the concurrency model within a worker, making shared mutable state genuinely dangerous, and it should be enabled only with tests that actively exercise concurrent requests. Feature adoption (WebSocket, timers, tasks) follows coroutine stabilization, if at all.

Operational Impact

Maintenance. The project shows active maintenance — the v3.8.8 release is a hygiene fix, but its existence is a legitimate input to the buy-versus-build risk call, particularly against a custom Swoole bootstrap that would be entirely internally owned. That said, the maintenance burden shifts rather than disappears: the team inherits responsibility for worker lifecycle management, max_request tuning, connection-pool configuration, and continuous auditing for state leakage as new dependencies are added. This is a permanent, ongoing tax on every future feature branch, not a one-time migration cost.

Support. The package is MIT-licensed with no commercial SLA or vendor escalation path. Community support via the repository is the ceiling. For an organization accustomed to vendor-backed runtimes — or for anything on a critical revenue path — this is a real gap that should be acknowledged in the adoption memo rather than discovered during an incident. The availability of a vendor-maintained alternative (Octane) with multi-runtime exit ramps makes the absence of commercial support a genuine differentiator rather than an abstract concern.

Scaling. The unit economics change shape. Fewer instances deliver the same RPS because boot cost is amortized, but per-instance memory is materially higher and the scaling curve is driven by worker count, not by process spawn rate. max_request becomes a tuning dial with two failure directions: set too high and slow memory leaks accumulate across requests; set too low and the team pays Laravel's boot cost constantly, eroding the entire premise of the adoption. Instance sizing and cloud-spend forecasts must be rebuilt around RSS-over-time observation rather than carried over from PHP-FPM intuition. Note also that Swoole Table shared memory is the correct mechanism for cross-worker state (WebSocket fd maps, counters, rate limiters) and must be kept small and fixed-width — it is not a database and should not be treated as one.

Failure modes. These are the scenarios to pre-write runbooks for, because they are subtle and slow-burning rather than clean crashes.

  • Cross-request state bleed: user A's locale, auth guard, or cached data served to user B. Intermittent and hard to reproduce; the highest-severity risk in the set.
  • Worker stall from blocking I/O: one synchronous outbound call degrades every user on that worker simultaneously. Presents as a capacity cliff, not a bug.
  • Stale database connections: "MySQL server has gone away" after long idle periods.
  • Memory growth: gradual RSS creep culminating in OOM; bounded only by max_request recycling.
  • WebSocket worker death: an uncaught exception in onMessage drops every connection that worker owns.
  • Silent debugging failure: dd()/dump()/echo produce worker stdout rather than responses, lengthening incident diagnosis.
  • Deployment friction: reload handles worker-level changes (code, .env, app config) but master-level settings (port, worker_num, task_worker_num, WebSocket handler class, table schema, server.options) require a full restart — a distinction that will cause at least one failed deploy if not codified in the deploy script.
  • Container start failures: the pid file under storage/ requires a writable path in non-root containers.

Ramp-up. The capability gap is real and should be scoped and funded explicitly. Engineers must internalize that nothing is per-request unless they make it so — a genuine inversion of the mental model that PHP developers have spent their careers building. They must also learn bin/laravels as the true entry point and process supervisor, the CleanerInterface/TableInterface/TaskInterface/WebSocketHandlerInterface extension points, the SwooleEvent lifecycle setters as the supported instrumentation hook, and the debugging toolkit (bin/laravels info, worker stats, the Swoole error log, strace/ps on worker PIDs). Realistically this is weeks of deliberate ramp-up with a code-review checklist enforcing stateless-by-construction controllers, not an afternoon of documentation reading. The mitigation is structural: assign a named owner, run the pilot on a single high-traffic service, and require the concurrency regression suite as a merge gate before any second service adopts the runtime.

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.
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console