PHPackages                             gabrielbull/websocket-client - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. gabrielbull/websocket-client

ActiveLibrary[HTTP &amp; Networking](/categories/http)

gabrielbull/websocket-client
============================

A simple PHP WebSocket Client

0.3.1(11y ago)8297.2k↓18.4%30[1 issues](https://github.com/gabrielbull/php-websocket-client/issues)MITPHPPHP &gt;=5.4.0

Since Nov 3Pushed 11y ago7 watchersCompare

[ Source](https://github.com/gabrielbull/php-websocket-client)[ Packagist](https://packagist.org/packages/gabrielbull/websocket-client)[ Docs](https://github.com/gabrielbull/php-websocket-client)[ RSS](/packages/gabrielbull-websocket-client/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (3)Versions (11)Used By (0)

WebSocket client
================

[](#websocket-client)

[![Build Status](https://camo.githubusercontent.com/da5e9800c0fe7cba92ab557e6a2e1cd8a62110275130f7425d5d8756f7369fca/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6761627269656c62756c6c2f7068702d776562736f636b65742d636c69656e742f6d61737465722e7376673f7374796c653d666c6174)](https://travis-ci.org/gabrielbull/php-websocket-client)[![Latest Stable Version](https://camo.githubusercontent.com/2dee20ff2488414b5d55f789be65ac79efe58fa6b66a8aa415dd30a889821a0c/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6761627269656c62756c6c2f776562736f636b65742d636c69656e742e7376673f7374796c653d666c6174)](https://packagist.org/packages/gabrielbull/websocket-client)[![Total Downloads](https://camo.githubusercontent.com/7e32ca4117e948d2a6d27e7ccdee5796dab50186db628ee7c8265763514babe4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6761627269656c62756c6c2f776562736f636b65742d636c69656e742e7376673f7374796c653d666c6174)](https://packagist.org/packages/gabrielbull/websocket-client)[![License](https://camo.githubusercontent.com/36d35e0b245354d0217d84168a62da925e60aae34d460984e7b4570d7aced2ec/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6761627269656c62756c6c2f776562736f636b65742d636c69656e742e7376673f7374796c653d666c6174)](https://packagist.org/packages/gabrielbull/websocket-client)

A simple WebSocket WAMP client implemented in PHP.

This is an implementation of WAMP version 1. I have not had the time to implement WAMP 2, but if you do, that would be awesome.

Requirements
------------

[](#requirements)

This library uses PHP 5.4+.

Install
-------

[](#install)

It is recommended that you install the WebSocket client library [through composer](http://getcomposer.org).

```
{
    "require": {
        "gabrielbull/websocket-client": "dev-master"
    }
}
```

Usage
-----

[](#usage)

Here is an example of a simple WebSocket client:

```
use WebSocketClient\WebSocketClient;
use WebSocketClient\WebSocketClientInterface;

class Client implements WebSocketClientInterface
{
    private $client;

    public function onWelcome(array $data)
    {
    }

    public function onEvent($topic, $message)
    {
    }

    public function subscribe($topic)
    {
        $this->client->subscribe($topic);
    }

    public function unsubscribe($topic)
    {
        $this->client->unsubscribe($topic);
    }

    public function call($proc, $args, Closure $callback = null)
    {
        $this->client->call($proc, $args, $callback);
    }

    public function publish($topic, $message)
    {
        $this->client->publish($topic, $message);
    }

    public function setClient(WebSocketClient $client)
    {
        $this->client = $client;
    }
}

$loop = React\EventLoop\Factory::create();

$client = new WebSocketClient(new Client, $loop);

$loop->run();
```

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity45

Moderate usage in the ecosystem

Community18

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 84.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~38 days

Recently: every ~74 days

Total

9

Last Release

4273d ago

PHP version history (2 changes)0.1.0PHP &gt;=5.3.9

0.3.1PHP &gt;=5.4.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/fcd3c0ec0f06b3ff94878dbcf5dad6bdfa1813c2c0bf753af44dd3184c3a2a04?d=identicon)[gabrielbull](/maintainers/gabrielbull)

---

Top Contributors

[![gabrielbull](https://avatars.githubusercontent.com/u/671923?v=4)](https://github.com/gabrielbull "gabrielbull (11 commits)")[![lifeofguenter](https://avatars.githubusercontent.com/u/241073?v=4)](https://github.com/lifeofguenter "lifeofguenter (1 commits)")[![maxpowel](https://avatars.githubusercontent.com/u/529550?v=4)](https://github.com/maxpowel "maxpowel (1 commits)")

---

Tags

clientwebsocket

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/gabrielbull-websocket-client/health.svg)

```
[![Health](https://phpackages.com/badges/gabrielbull-websocket-client/health.svg)](https://phpackages.com/packages/gabrielbull-websocket-client)
```

###  Alternatives

[ratchet/pawl

Asynchronous WebSocket client

6148.9M214](/packages/ratchet-pawl)[swow/swow

Coroutine-based multi-platform support engine with a focus on concurrent I/O

1.3k2.1M84](/packages/swow-swow)[react/http

Event-driven, streaming HTTP client and server implementation for ReactPHP

78026.4M414](/packages/react-http)[phrity/websocket

WebSocket client and server

2184.1M27](/packages/phrity-websocket)[amphp/websocket-client

Async WebSocket client for PHP based on Amp.

1623.0M39](/packages/amphp-websocket-client)[hemiframe/php-websocket

PHP WebSocket server and client library

4911.0k](/packages/hemiframe-php-websocket)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
