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

Rfc6455 Laravel Package

ratchet/rfc6455

A framework-agnostic RFC6455 WebSocket protocol handler for PHP, with components for both server- and client-side handshake and messaging negotiation. It performs no I/O itself; HTTP upgrade integration is handled through PSR-7 interfaces, leaving implementation-specific interpretations open.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit. ratchet/rfc6455 is a protocol handler, not a WebSocket server. It owns RFC6455 framing, the opening handshake (server and client side), message assembly, UTF-8 validation, close-code semantics, and permessage-deflate — and it deliberately owns no I/O. That single design decision determines the whole integration shape: it cannot run inside Laravel's request/response lifecycle under PHP-FPM, because WebSocket connections are persistent and FPM workers are not. Any adoption therefore implies a two-tier architecture: Laravel remains the system of record (auth, authorization, business rules, persistence), and a separate long-running event-loop process becomes the real-time edge. The two tiers talk over HTTP, a queue, or Redis pub/sub.

This is a good fit if the requirement is protocol-level control without a vendor dependency. It is a poor fit if the expectation is "composer require and add a Laravel feature" — nothing about channels, presence, broadcasting auth, or Laravel Echo semantics ships here. As a TPM, the framing question is not "is this package good" (it is competent and Autobahn-conformant) but "are we buying a protocol library and funding a real-time service, or are we buying a real-time service?"

Integration feasibility. The composer require is trivial; the assembly is the project. A production slice requires, at minimum:

Component What we must supply Notes
Event loop / socket layer react/socket or Amp Not in this package; also the team's biggest skill gap risk
PSR-7 / PSR-17 nyholm/psr7, guzzlehttp/psr7, etc. 0.4.0 replaced Guzzle objects with PSR-17 factories
Handshake route Laravel route → PSR-7 → ServerHandshake → PSR-7 response Feasible via Symfony's PSR HTTP bridge
Auth bridge Signed short-lived connection tickets Avoid per-connection HTTP round trips to Laravel
Supervision & deploy systemd / Supervisor / container orchestration Long-running process, graceful drain required
Fanout Redis pub/sub or NATS Required for any multi-node deployment

Indicative shaping for planning (assumes a team unfamiliar with ReactPHP):

Milestone Scope Effort
Spike Handshake + echo + one authenticated message 1–2 eng-weeks
Vertical slice One real feature, internal users, single node 3–5 eng-weeks
Production single-node Auth tickets, limits, observability, deploy/drain 6–10 eng-weeks
Horizontal scale Pub/sub fanout, presence, LB tuning, cutover +4–8 eng-weeks

The mandatory build-vs-buy comparison is Laravel Reverb (first-party, Laravel 11+, same ReactPHP lineage, ships the channel/presence/authorization layer) versus a managed service (Pusher, Ably, Soketi). This package only wins on a specific, articulable requirement: custom subprotocol negotiation, strict control over frame and compression policy, client-side handshake (rare in a Laravel context), or embedding into an event loop that isn't ReactPHP's. Without one of those, recommending Reverb is the defensible default and this package is a distraction.

Technical risk: Medium.

Positives: Autobahn Testsuite passing (meaningful, independent conformance evidence), MIT license, clean PSR-7/17 abstractions, explicit frame and buffer size limits since 0.2.6, PHP 8.5 compatibility work in 0.4.1, active maintenance across 0.2 → 0.4.

Negatives to put in front of a steering group:

  • Pre-1.0 churn. 0.4.0 changed the HTTP abstraction layer and raised the PHP floor to 7.4. Breaking changes are expected, not exceptional. Every bump is a review task.
  • Thin adoption signal. 236 stars and near-zero direct dependents in our scan. That understates reality — ratchet/ratchet is the primary consumer — but it means we cannot lean on a large public corpus of Laravel-specific prior art when we hit problems.
  • Release metadata anomaly. The recorded last release is dated 2026-06-06, a future date. Verify tag provenance, signing, and actual commit history before pinning. Treat release cadence as unproven until confirmed.
  • Explicitly deferred semantics. The README states that where the RFC is ambiguous, the library leaves the decision to the implementer. Those decisions become our code, our review burden, and our incident postmortems.
  • No support contract. No commercial backing, minimal documentation beyond README and API. Knowledge is concentrated in a small maintainer group.

Key questions to resolve before committing budget:

  1. Why not Reverb or a managed service? Name the specific capability this unlocks that they don't. If we can't, stop here.
  2. Which event loop — ReactPHP or Amp — and does anyone on the team have production experience with it?
  3. How do auth and session state reach the socket process? Per-connection callback to Laravel, or locally-validated signed tickets?
  4. What are the targets: concurrent connections, messages/second, fanout pattern (broadcast vs rooms vs presence), regions?
  5. Server-side handshake only, or is client-side handshake genuinely needed?
  6. Does any feature require durable delivery, replay, or at-least-once semantics? This package provides none of that; it must be designed on top.
  7. Who is on call for this service, and what uptime SLA are we implicitly promising?
  8. Does the product currently depend on Laravel Echo channel/presence/broadcasting-auth semantics? If yes, that is reimplementation work, not integration work.

Integration Approach

Stack fit. Laravel 10/11 on PHP 8.1+ comfortably clears the 7.4 floor. PSR-7/17 maps cleanly onto Symfony's PSR HTTP message bridge, so the opening handshake can be driven from a Laravel route: convert the incoming request to PSR-7, delegate to ServerHandshake, translate the PSR-7 response back — then hand the live connection to the socket process. Redis is the natural companion for presence and pub/sub fanout; the relational database stays the durable store. There is no service provider, facade, config file, or artisan command — that glue is ours to write, and worth packaging internally as a reusable Laravel bridge if more than one project will need it.

Migration path. Incremental, feature-flagged, with a cheap reversal point early:

  1. Spike (1–2 weeks). Prove ServerHandshake against real PSR-7 objects, decode with Frame::fromBuffer(), assemble with MessageBuffer, echo a message end to end. Decide the event loop here — this is the cheapest moment to reverse course to Reverb.
  2. Auth bridge. Laravel endpoint issuing short-lived signed connection tickets; the socket process validates locally. This is the single most important design decision for latency and for keeping Laravel out of the hot path.
  3. Vertical slice. Ship one real feature behind a flag to internal users only. Instrument from day one — connection count, message rate, buffer depth, close-code distribution.
  4. Scale-out. Redis pub/sub fanout, presence registry, load-balancer routing for HTTP Upgrade.
  5. Cutover. If displacing Pusher/Ably, dual-publish and migrate cohorts, with a documented, rehearsed rollback.

Compatibility. No native Laravel coupling means no framework-upgrade hazard from this package — a genuine advantage, and worth stating explicitly since it's unusual. Watch two things: (a) conflicts when multiple PSR-7/17 implementations coexist in the Composer graph, and (b) the Octane story — coexistence is fine precisely because the socket process is separate from FPM/Octane workers, but that only holds if nobody tries to run the socket server inside an Octane worker. Document that anti-pattern.

The real compatibility gap is semantic, not technical: if the product currently relies on Laravel Echo's channel authorization, private/presence channel semantics, and broadcast event shape, none of that comes with this package. Broadcasting auth, subscription management, and presence are all reimplementations. On comparable projects this gap is the single largest source of estimate slippage — budget for it explicitly rather than discovering it in the vertical slice.

Sequencing and de-risking. Three rules:

  • Fix the wire contract first — message envelope schema, version field, error codes, close-code taxonomy — before any transport code. This lets client and server be built in parallel and keeps the transport swappable.
  • Abstract the broadcast boundary behind an internal interface so a fallback to a vendor (or to Reverb) remains a configuration change rather than a rewrite. This is the concrete hedge against the ownership risk.
  • Land the operational story in the same milestone as the first feature — deploy, drain, reconnect, observability. "Phase two operations" is the phase that never gets funded.

Operational Impact

Maintenance. We own everything above the frame: connection registry, heartbeats, reconnect/resume semantics, backpressure, graceful shutdown, TLS termination, and the internal bridge. Upstream is pre-1.0, so budget roughly 1–2 engineer-days per quarter for version review and upgrades, plus a security-patch SLA. Pin exact versions, read changelogs before bumping, and add the dependency to the GitHub security advisory watchlist — there is no vendor advisory channel. Note that the PHP 8.5 fixes in 0.4.1 are a good signal; the project is tracking modern PHP rather than ossifying.

Support. No commercial support and a small community mean internal expertise is the entire safety net. This is the sharpest contrast with a managed service, where the failure surface belongs to someone else. Mitigations: designate one or two named owners, require a written runbook before the first production feature, and treat "the engineer who understands the event loop is on holiday" as a genuine operational risk rather than a joke. Cross-train at least one backup.

Scaling. Capacity planning is memory-per-connection plus event-loop budget, not FPM worker counts — the cost curve favors fewer, larger instances, which changes the infrastructure cost model and the auto-scaling story relative to the rest of the Laravel estate. Horizontal scale requires Redis or NATS fanout and a presence registry, both of which we build. Infrastructure prerequisites that routinely bite:

  • Load balancer must pass HTTP Upgrade (ALB does) with idle timeout raised well above default — the default 60s silently kills idle sockets.
  • nginx needs proxy_read_timeout, proxy_http_version 1.1, and explicit Upgrade/Connection header passthrough.
  • TLS terminates at the edge; WSS is mandatory for browser clients.
  • Sticky or connection-aware routing if any per-connection state is node-local.

Plan single-region before multi-region. Cross-region fanout is a materially harder problem and should not be in the first roadmap.

Failure modes to design against.

  • Slow or malicious clients accumulating buffer memory. Set MessageBuffer::$maxBufferLength explicitly (the default is ~2 MB) and map overflow to close code 1009 rather than letting the process OOM. A single unbounded client can take down a node hosting thousands of healthy ones — this is the highest-severity failure mode and the cheapest to prevent.
  • Large payloads. The 2 GB support added in 0.4+ is bounded in practice by PHP's memory_limit and the number of concurrent connections. Enforce an application-level message size cap well below the theoretical ceiling.
  • Node loss. Every connection on that node drops simultaneously. Clients must reconnect with jittered backoff; the reconnect storm is the real incident, not the node failure. Design the storm control before the first multi-node deploy.
  • Deploy/drain. Without graceful shutdown that sends close frames and lets the LB deregister, every deploy is a user-visible disconnect event.
  • Unauthenticated or expired sessions. Ticket expiry must be handled mid-connection, not only at handshake.
  • Observability gap. No metrics ship with this package. Connection count, message rate, buffer depth, close-code distribution, and event-loop lag must be built into the vertical slice or we will be debugging production blind.

Ramp-up. Expect 2–3 weeks before a competent Laravel engineer is productive in an async, event-loop, connection-stateful programming model — it is a genuinely different mental model from request/response, and the failure modes (blocking the loop, leaking listeners, unhandled promise rejections) are unfamiliar. The protocol layer is the small part; the async runtime discipline is the large part. Factor this into the estimate and into the hiring/training plan, and consider pairing the spike with someone who has prior ReactPHP or Swoole experience.

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.
dakiquang/laravel-oauth-refresh-lock
woda/laravel-worktrees
dalefranks/ramasite
faghy/laracashbook
roundly-consulting/google-places-for-laravel
roundly-consulting/kubernetes-api-for-laravel
roundly-consulting/plausible-for-laravel
gvp/gvp-laravel-template
metasyncsite/laravel-metasync-client
roundly-consulting/onboarding-for-laravel
andydefer/laravel-notification
adachsoft/cli-process-tester
jhaskell13/laraflow
sebastienheyd/boilerplate-media-manager
ccast/tagixo-primix
pretendtrue/laravel-builder
sawmainek/laravel-scout-tntsearch-driver
tomshaw/laravel-calendar-table
dibakar/laravel-ownership
adachsoft/changelog-linter