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

Phpsocket.io Laravel Package

workerman/phpsocket.io

PHP Socket.IO server built on Workerman for real-time WebSocket apps. Supports event handling, rooms, namespaces, and Socket.IO client compatibility, offering a practical PHP alternative to Node.js for bidirectional communication.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit. Unchanged in substance: workerman/phpsocket.io is not a Laravel package — it is a standalone Socket.IO-protocol server built on the Workerman event loop. No service provider, no config publish, no HTTP kernel hook. It runs as a long-lived CLI process alongside your Laravel app. Architecturally it is a second deployable: a realtime tier with its own lifecycle, supervision, scaling axis, and failure domain. You are not adding a dependency, you are adding a service.

Fit is good when (1) the client side is already committed to the Socket.IO wire protocol, and (2) the organization wants to keep realtime in PHP rather than introduce a Node runtime. Otherwise Laravel Reverb or Soketi remains the lower-risk default.

Integration feasibility. Composer install is trivial; the real work is unchanged — bootstrapping Laravel inside a Workerman worker (config, container, DB connections) and bridging FPM to the socket process via Redis pub/sub, workerman/channel, or an internal endpoint. That bridge is custom code you own.

New in this release cycle: the v3 line is still in beta. v3.0.0-beta.2 explicitly states there are "no new breaking changes beyond what v3.0.0-beta.1 already introduced" — which confirms v3 is a breaking major that has not reached GA. That is a release-management constraint, not just a technical one: production adoption today means either running a beta or staying on the 2.x line and absorbing a migration later. Both are viable; neither is free. This should be an explicit decision recorded before any spike, not discovered at cutover.

Technical risk.

  • Protocol skew (still highest). Unchanged: verify Engine.IO v4 / Socket.IO 3.x–4.x parity against your exact pinned client. Nothing in this release addresses protocol-version coverage.
  • Transport edge cases ship under-tested (newly evidenced, partially mitigated). beta.2 fixed two bugs beta.1 users would have hit in production: a fatal error on PHP 8+ in the WebSocket handshake path whenever handshake headers did not arrive in a single read, and a TypeError for any JSONP/polling-fallback client POSTing data. Both are the class of defect that only appears under real network conditions — fragmented reads behind a proxy, load balancer, or TLS terminator — and both reached a tagged release. Treat this as evidence about maturity, not as a resolved issue: it tells you the transport layer has not been exercised across realistic edge topologies.
  • Mitigation is real but narrow. PHPStan ramped 0→6, CI now runs static analysis alongside lint, and RFC6455.php (raw frame parsing — headers, extended length, masking, fragmentation, ping/pong/close) went from 0% to covered with 22 tests including the RFC 6455 §1.3 handshake vector. That is a genuine health improvement in the most correctness-sensitive file. It does not extend to the Engine.IO/transport layer, the Socket.IO protocol layer, or the polling/JSONP paths where the other two bugs lived — coverage is now concentrated, not broad.
  • Dual PHP support matrix. The changelog references divergent behavior "on PHP 7.x," implying the package still carries PHP 7 compatibility branches. Our stack is PHP 8.1+, so we are exercising one side of a fork the maintainer must keep green with a small test suite.
  • Single-maintainer / low bus factor. Unchanged. Static analysis adoption is a positive signal about maintainer intent; it is not a bus-factor fix.
  • No first-party Laravel integration. Auth, tenancy, broadcast semantics all bespoke.
  • Long-running process hazards. Unchanged and still the most common production incident: blocking calls in a handler stall the whole worker.
  • No Socket.IO Redis-adapter semantics. Horizontal scale still requires GatewayWorker or custom fan-out.

Key questions.

  1. Which socket.io-client version and Engine.IO protocol does production use, and has a handshake + room + ack round-trip been verified against this server?
  2. Which release line do we adopt — 2.x stable with a planned 3.0 migration, or 3.0 beta now? What is our exit criteria and fallback if 3.0 stalls in beta?
  3. Does our edge path (ALB/Nginx/Envoy, TLS termination, HTTP/2) deliver WebSocket handshake headers in fragmented reads? beta.1 would have hard-fataled on PHP 8 in that case. This must be reproduced in the spike through the real ingress, not on localhost.
  4. Do we depend on the polling/JSONP fallback transport for restrictive networks or older clients? That path was broken for JSONP POSTs until this release.
  5. Is there an existing client commitment, or is this a greenfield choice where Reverb/Soketi should be compared on equal footing?
  6. What is the peak concurrent connection count, messages/sec, and fan-out width?
  7. Do we need cross-host broadcast and room membership, or does a single node with multiple workers suffice?
  8. How will handshake authentication work — session cookie decryption in the Workerman process, or a short-lived signed token?
  9. Who owns the runbook, on-call, and process supervision for a new stateful tier?
  10. Is forking/patching acceptable if upstream protocol support stalls?

Integration Approach

Stack fit. Laravel 10–12 on PHP 8.1+, Workerman 4/5, Redis as the broadcast bridge, Nginx terminating TLS and proxying WebSocket upgrades. Frontend pins socket.io-client explicitly (no floating range). Deployment target needs a supervisor (systemd/Supervisor) and a process that is not recycled per-request.

Version policy (new). Pin an exact tag — never a range, never a branch. Record whether that tag is stable or beta, and require a written reason if beta. Add a standing rule: any upstream bump that touches Engine/, RFC6455.php, or the polling transports re-runs the handshake/transport regression suite before merge, because that is precisely where the last two production bugs lived.

Migration path. Two viable shapes:

  • Node socket.io → phpsocket.io: lowest client impact, wire protocol preserved. Server-side only; risk concentrates in protocol-version parity and feature gaps (namespaces, acks, binary, volatile emits — audit each).
  • Polling/AJAX → websockets: larger scope; a feature migration with its own UX validation, not a package swap.

If the current stack is Pusher/Echo, do not migrate for its own sake.

Compatibility concerns. Handshake auth (cookie decryption vs. token), CORS/origin allowlists, sticky routing across accepting workers, and Laravel's per-request container assumptions. Config and route caching behave differently under a long-lived process; audit anything relying on request-scoped state. If the team runs Octane the mental model transfers, but Octane's safety guarantees do not. Note also that the package's PHP 7 branches mean the code paths we exercise are the less-exercised half of a dual matrix.

Sequencing.

  1. Spike (1 week) — go/no-go gate. Minimal Workerman server, pinned client, prove handshake + auth + room join + broadcast + reconnect. Add explicitly: force a fragmented handshake (send headers in split writes, or route through the actual ingress with a small MSS) to confirm the beta.2 fix holds under our topology, and exercise the polling fallback path even if only to confirm it is disabled by config.
  2. Version decision. Commit to 2.x-stable-with-migration-plan or 3.0-beta-with-exit-criteria; document the fallback (Node socket.io server behind the same client contract).
  3. Bridge. Redis pub/sub from Laravel events to the socket tier; define a single outbound message contract.
  4. Auth & tenancy. Token issuance, channel authorization, revocation path.
  5. Load test. Target concurrency × 1.5 through the real edge path; measure event-loop lag, memory growth over 24h, fd/ulimit headroom.
  6. Ops hardening. Supervision, health endpoint, structured logs, metrics, graceful reload.
  7. Cutover. Parallel-run behind a feature flag, then decommission the old transport.

Operational Impact

Maintenance. Pin the package and the client; treat upstream protocol changes as a tracked dependency with a named owner. Static analysis at level 6 with CI enforcement is a meaningful reduction in the "silently broken" surface and makes carrying a fork more tractable than it was a release ago — but the test suite is young and concentrated in one file, so "CI is green" is weaker evidence here than it would be on a mature package. Budget a small permanent allowance for patching; keep an explicit exit plan (fall back to a Node socket.io server behind the same client contract). Cheap to design now, expensive retroactively.

Support. Community-only. No vendor SLA, no paid escalation. Internal expertise is the support model, so the runbook and a named owner are prerequisites. Security posture of this specific diff was reviewed with no injection/auth/data-exposure findings — a good signal, not a standing guarantee, and not a substitute for our own review on each bump.

Scaling. Three stages: vertical (bigger box, raise ulimit -n), multi-process on one host (Workerman native, cheap), then horizontal via GatewayWorker with a register service or custom Redis-backed fan-out. Stage three is where cost and complexity jump, and where the absence of Socket.IO's Redis-adapter semantics bites. Capacity planning should account for per-connection memory (tens of KB) plus buffers; slow or half-open clients drive memory drift.

Failure modes to instrument for.

  • Worker crash with no supervisor → silent realtime outage while HTTP stays green. Needs an external liveness probe.
  • Blocking I/O in a handler → whole-node latency spike, not one slow request.
  • Memory growth from timers, closures, or unbounded per-connection state → OOM after days. Requires soak test and RSS alerting.
  • Handshake/transport edge-case failure (newly evidenced). A fault in header parsing or a fallback transport produces a hard failure or silent degradation that localhost and CI never see. Test through the production ingress; alert on handshake failure rate and on fallback-transport usage, which should normally be ~0.
  • Redis bridge disconnect → events accepted by Laravel, never delivered, no error to the publisher. Needs a dead-letter or a published-vs-delivered counter.
  • Protocol mismatch after a frontend dependency bump → handshake succeeds, features silently degrade. Pin the client; fail the build on drift.
  • Deploy/reload dropping connections → clients need reconnect-with-backoff; reloads graceful and off-peak.

Ramp-up. Two to four weeks for a mid-level Laravel team to be genuinely productive: event-loop concurrency, Workerman lifecycle, long-running-process hygiene, async debugging. PHP syntax is familiar; the debugging model is not — stack traces cross event boundaries and dd()/Xdebug-per-request reflexes do not apply. The beta status of v3 adds a second ramp-up item: whoever owns this must be able to read a transport-layer diff and judge whether a patch is safe to take, because upstream will not do that judgement for us. Fund one named owner and that skill before first cutover, not after the first incident.

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.
socialdept/tenant-domains
tautvydasr/blade-class-names
socialdept/color-scales
maherelgamil/controller
coleus/widgets
coleus/table
coleus/users
coleus/music
coleus/health
coleus/calendar
coleus/notes
coleus/support
coleus/settings
coleus/apps
seampact/laravel
emmyconceptng/laravel-ng-postcode
jjsquady/round-robin
skyraptor/chatter
edlugz/sasapay
abbasudo/artisan-route