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

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

Workerman/PHPSocket.IO is a PHP Socket.IO server built on Workerman, enabling real-time bidirectional communication between browsers and PHP without Node.js. It implements the Socket.IO protocol over WebSocket and HTTP long polling, making it suitable for chat, notifications, live dashboards, and other push-based apps.

  • Socket.IO-compatible events, acknowledgements, namespaces, and rooms
  • Broadcasting, private messages, and room join/leave support
  • WebSocket transport with HTTP long-polling fallback
  • SSL/TLS support and customizable handlers
  • High-concurrency, event-driven architecture powered by Workerman
Frequently asked questions about Phpsocket.io
Is workerman/phpsocket.io a Laravel package?
No. It is a standalone Socket.IO-protocol server built on the Workerman event loop and does not register a service provider, publish config, or hook into the Laravel HTTP kernel. It runs as a long-lived CLI process alongside your Laravel application rather than inside it, so you are effectively adding a second deployable realtime tier with its own lifecycle and supervision. Composer installation is trivial, but you own the bootstrapping of Laravel config, container, and database connections inside the Workerman worker.
Does phpsocket.io work with socket.io-client 4.x and Engine.IO v4?
This is the highest-risk area and must be verified before any planning commitment. Socket.IO 3.x and 4.x moved to Engine.IO v4, and PHP reimplementations historically lag, often working cleanly only with 1.x or 2.x clients. A mismatch is a silent failure mode where the handshake appears to succeed but events never route, so test a full handshake, room join, and ack round-trip against the exact client version pinned in your frontend.
How do I install and run a PHPSocket.IO server next to Laravel?
Install with composer require workerman/phpsocket.io and write a standalone PHP entry script that creates the Socket.IO server, attaches Workerman workers, and listens on your chosen port. Do not serve it through PHP-FPM or your web server's request cycle; run it as a supervised CLI process under systemd or Supervisor. Nginx typically terminates TLS and proxies WebSocket upgrades to that port.
How do I broadcast a Laravel event to PHPSocket.IO clients?
Laravel cannot call the socket server directly because it lives in a separate process, so every broadcast path needs a transport you build yourself. Common options are Redis pub/sub subscribed by the Workerman process, workerman/channel, or an internal TCP or HTTP endpoint exposed by the socket server. This bridge is custom code you own, not something the package provides out of the box.
Should I use PHPSocket.IO or Laravel Reverb and Soketi?
Choose PHPSocket.IO when your clients are already committed to the Socket.IO wire protocol or you specifically want to keep realtime in PHP rather than introduce a Node runtime. If neither condition holds, Laravel Reverb, which is first-party and Pusher-protocol based, or Soketi is the lower-risk default. Comparing them on equal footing during a greenfield decision is strongly recommended.
Does PHPSocket.IO support rooms, broadcasts, and events?
Yes. It provides an event-driven server with WebSocket support, rooms, broadcasts, and client compatibility for building chat, live notifications, and dashboards. Handlers such as connection and custom events let you join sockets to rooms and emit to specific rooms or all clients. Auth, tenancy, and broadcast semantics around those primitives are bespoke and must be designed by your team.
How do I scale PHPSocket.IO across multiple servers?
Cross-node broadcast and room state are not implemented out of the box, so the package does not give you Socket.IO Redis-adapter semantics. Horizontal scale requires GatewayWorker or a custom pub/sub fan-out layer that keeps room membership consistent across nodes. Confirm your peak concurrent connections, messages per second, and fan-out width before deciding whether a single node with multiple workers is sufficient.
How do I authenticate Socket.IO connections in a PHP realtime server?
Handshake authentication is entirely custom, since there is no first-party Laravel integration for guards or sessions. You can decrypt and validate the Laravel session cookie inside the Workerman process, or issue a short-lived signed token that the client sends during the handshake and the server verifies. Whichever you choose, document it clearly because it is a distinct security surface from your HTTP app.
Why does my Workerman socket server freeze or stop responding?
Blocking calls inside event handlers stall the entire worker rather than a single request, which is the most common production incident with Workerman. Synchronous Eloquent queries, outbound HTTP calls, and slow file I/O will freeze all connections handled by that process. Keep handlers non-blocking, offload heavy work to queues or async clients, and monitor event loop latency.
Is phpsocket.io actively maintained and which PHP versions does it support?
It is MIT licensed with effectively a single author, so the bus factor is low and support is community-driven. The metadata shows recent releases, but you should check release cadence and issue throughput directly before committing. Verify compatibility against your PHP 8.1+ and Workerman 4 or 5 stack, and decide in advance whether forking or patching is acceptable if upstream protocol support stalls.
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