PHPackages                             vakata/websocket - 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. vakata/websocket

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

vakata/websocket
================

PHP websocket server and client

2.1.0(2y ago)467.6k↓33.3%17[1 issues](https://github.com/vakata/websocket/issues)1MITPHPPHP &gt;=8.0

Since Feb 17Pushed 2y ago6 watchersCompare

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

READMEChangelogDependenciesVersions (8)Used By (1)

websocket
=========

[](#websocket)

[![Latest Version on Packagist](https://camo.githubusercontent.com/3edaaae572d96d374094ea98ac78d46b70bb8c4df23c526f42b0b4035d6ffa58/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f76616b6174612f776562736f636b65742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/vakata/websocket)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)

PHP websocket server and client. Supports secure sockets.

Install
-------

[](#install)

Via Composer

```
$ composer require vakata/websocket
```

Server usage
------------

[](#server-usage)

```
// this handler will forward each message to all clients (except the sender)
$server = new \vakata\websocket\Server('ws://127.0.0.1:8080');
$server->onMessage(function ($sender, $message, $server) {
    foreach ($server->getClients() as $client) {
        if ($client !== $sender) {
            $client->send($message);
        }
    }
});
$server->run();
```

Client usage
------------

[](#client-usage)

```
// this handler will echo each message to standard output
$client = new \vakata\websocket\Client('ws://127.0.0.1:8080');
$client->onMessage(function ($message, $client) {
    echo $message . "\r\n";
});
$client->connect();
```

Usage in HTML
-------------

[](#usage-in-html)

```
var sock = new WebSocket('ws://127.0.0.1:8080/');
sock.send("TEST");
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [vakata](https://github.com/vakata)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity37

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity73

Established project with proven stability

 Bus Factor1

Top contributor holds 93.9% 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 ~445 days

Recently: every ~50 days

Total

7

Last Release

1069d ago

Major Versions

1.0.1 → 2.0.02022-11-24

PHP version history (2 changes)1.0.0PHP &gt;=5.4.0

2.0.0PHP &gt;=8.0

### Community

Maintainers

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

---

Top Contributors

[![vakata](https://avatars.githubusercontent.com/u/146052?v=4)](https://github.com/vakata "vakata (31 commits)")[![mruz](https://avatars.githubusercontent.com/u/2629882?v=4)](https://github.com/mruz "mruz (1 commits)")[![rtcoder](https://avatars.githubusercontent.com/u/10314476?v=4)](https://github.com/rtcoder "rtcoder (1 commits)")

---

Tags

websocketvakata

### Embed Badge

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

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

###  Alternatives

[cboden/ratchet

PHP WebSocket library

6.4k21.4M239](/packages/cboden-ratchet)[swow/swow

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

1.3k2.1M84](/packages/swow-swow)[ratchet/pawl

Asynchronous WebSocket client

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

RFC6455 WebSocket protocol handler

23433.7M69](/packages/ratchet-rfc6455)[wrench/wrench

PHP WebSocket client/server library

5903.1M11](/packages/wrench-wrench)[gos/web-socket-bundle

Symfony Web Socket Bundle

6202.2M8](/packages/gos-web-socket-bundle)

PHPackages © 2026

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