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.
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.
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.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.Key questions.
socket.io-client version and Engine.IO protocol does production use, and has a handshake + room + ack round-trip been verified against this server?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:
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.
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.
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.
How can I help you explore Laravel packages today?