Need help with websocket-php?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

637 Stars 197 Forks Other 244 Commits 4 Opened issues


WebSocket client and server in PHP

Services available


Need anything else?

Contributors list

Websocket Client and Server for PHP

Build Status Coverage Status

This library contains WebSocket client and server for PHP.

The client and server provides methods for reading and writing to WebSocket streams. It does not include convenience operations such as listeners and implicit error handling.



Preferred way to install is with Composer.

composer require textalk/websocket
  • Current version support PHP versions
  • For PHP
    support use version
  • For PHP
    support use version


The client can read and write on a WebSocket stream. It internally supports Upgrade handshake and implicit close and ping/pong operations.

$client = new WebSocket\Client("ws://");
echo $client->receive();


The library contains a rudimentary single stream/single thread server. It internally supports Upgrade handshake and implicit close and ping/pong operations.

Note that it does not support threading or automatic association ot continuous client requests. If you require this kind of server behavior, you need to build it on top of provided server implementation.

$server = new WebSocket\Server();
$message = $server->receive();

License and Contributors

ISC License

Fredrik Liljegren, Armen Baghumian Sankbarani, Ruslan Bekenev, Joshua Thijssen, Simon Lipp, Quentin Bellus, Patrick McCarren, swmcdonnell, Ignas Bernotas, Mark Herhold, Andreas Palm, Sören Jensen, pmaasz, Alexey Stavrov, Michael Slezak, Pierre Seznec, rmeisler, Nickolay V. Shmyrev, Christoph Kempen, Marc Roberts, Antonio Mora, Simon Podlipsky.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.