PHPackages                             chrome-php/wrench - 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. chrome-php/wrench

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

chrome-php/wrench
=================

A simple PHP WebSocket implementation

v1.8.0(4mo ago)673.7M—4%13[1 PRs](https://github.com/chrome-php/wrench/pulls)3MITPHPPHP ^7.4.15 || ^8.0.2CI passing

Since Aug 15Pushed 4mo ago3 watchersCompare

[ Source](https://github.com/chrome-php/wrench)[ Packagist](https://packagist.org/packages/chrome-php/wrench)[ RSS](/packages/chrome-php-wrench/feed)WikiDiscussions 1.8 Synced 1mo ago

READMEChangelog (10)Dependencies (4)Versions (20)Used By (3)

Wrench
======

[](#wrench)

[![Latest Stable Version](https://camo.githubusercontent.com/fbf8247894dd3c2a3b825a3d8ef266342117b34c88facea60a39c7e3ba80174d/68747470733a2f2f706f7365722e707567782e6f72672f6368726f6d652d7068702f7772656e63682f76657273696f6e)](https://packagist.org/packages/chrome-php/wrench)[![License](https://camo.githubusercontent.com/97288a656d7988f7b28250e4d0c86fa17102884697f5ba890fe9974c568c1cdb/68747470733a2f2f706f7365722e707567782e6f72672f6368726f6d652d7068702f7772656e63682f6c6963656e7365)](https://packagist.org/packages/chrome-php/wrench)

A simple PHP WebSocket implementation.

Installation
------------

[](#installation)

The library can be installed with Composer and is available on Packagist under [chrome-php/wrench](https://packagist.org/packages/chrome-php/wrench):

```
$ composer require chrome-php/wrench
```

PHP 7.4-8.5 are currently supported, only.

Usage
-----

[](#usage)

This creates a server on 127.0.0.1:8000 with one Application that listens for WebSocket requests to `ws://localhost:8000/echo` and `ws://localhost:8000/chat`:

### Server

[](#server)

```
// An example application, that just echoes the received
// data back to the connection that sent it
$app = new class implements \Wrench\Application\DataHandlerInterface
{
    public function onData(string $data, \Wrench\Connection $connection): void
    {
        $connection->send($data);
    }
};

// A websocket server, listening on port 8000
$server = new \Wrench\BasicServer('ws://localhost:8000', [
    'allowed_origins' => [
        'mysite.com',
        'mysite.dev.localdomain'
    ],
]);

$server->registerApplication('echo', $app);
$server->registerApplication('chat', new \My\ChatApplication());
$server->setLogger($monolog); // PSR3
$server->run();
```

### Client

[](#client)

```
// A client side example, that sends a string and will receive
// the data back to the connection that sent it
$client = new Client('ws://localhost:8000', 'http://localhost:8000');
$client->connect();
$client->sendData('hello');
$response = $client->receive()[0]->getPayload();
$client->disconnect();
```

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

[](#contributing)

See [CONTRIBUTING.md](.github/CONTRIBUTING.md) for contribution details.

License
-------

[](#license)

This project is licensed under the [The MIT License (MIT)](LICENSE).

###  Health Score

60

—

FairBetter than 99% of packages

Maintenance74

Regular maintenance activity

Popularity57

Moderate usage in the ecosystem

Community31

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 64.3% 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 ~88 days

Recently: every ~104 days

Total

19

Last Release

142d ago

PHP version history (2 changes)v1.0.0PHP ^7.3 || ^8.0

v1.4.0PHP ^7.4.15 || ^8.0.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/d95eb26cb8f3919bb5ca3b6d823daeabbf259663778a970349b245c580713c8e?d=identicon)[graham-campbell](/maintainers/graham-campbell)

---

Top Contributors

[![dominics](https://avatars.githubusercontent.com/u/97427?v=4)](https://github.com/dominics "dominics (263 commits)")[![GrahamCampbell](https://avatars.githubusercontent.com/u/2829600?v=4)](https://github.com/GrahamCampbell "GrahamCampbell (50 commits)")[![nekudo](https://avatars.githubusercontent.com/u/1132928?v=4)](https://github.com/nekudo "nekudo (38 commits)")[![Alarmfifa](https://avatars.githubusercontent.com/u/3095492?v=4)](https://github.com/Alarmfifa "Alarmfifa (7 commits)")[![nexen2](https://avatars.githubusercontent.com/u/11517874?v=4)](https://github.com/nexen2 "nexen2 (7 commits)")[![nicokaiser](https://avatars.githubusercontent.com/u/238631?v=4)](https://github.com/nicokaiser "nicokaiser (6 commits)")[![StyleCIBot](https://avatars.githubusercontent.com/u/11048387?v=4)](https://github.com/StyleCIBot "StyleCIBot (6 commits)")[![divinity76](https://avatars.githubusercontent.com/u/1874996?v=4)](https://github.com/divinity76 "divinity76 (4 commits)")[![DaSpors](https://avatars.githubusercontent.com/u/623201?v=4)](https://github.com/DaSpors "DaSpors (3 commits)")[![Rupert-RR](https://avatars.githubusercontent.com/u/1748972?v=4)](https://github.com/Rupert-RR "Rupert-RR (2 commits)")[![joy2fun](https://avatars.githubusercontent.com/u/7264066?v=4)](https://github.com/joy2fun "joy2fun (2 commits)")[![guweigang](https://avatars.githubusercontent.com/u/178500?v=4)](https://github.com/guweigang "guweigang (2 commits)")[![feifengxlq](https://avatars.githubusercontent.com/u/1271021?v=4)](https://github.com/feifengxlq "feifengxlq (2 commits)")[![dobrakmato](https://avatars.githubusercontent.com/u/779469?v=4)](https://github.com/dobrakmato "dobrakmato (2 commits)")[![vincentdieltiens](https://avatars.githubusercontent.com/u/589764?v=4)](https://github.com/vincentdieltiens "vincentdieltiens (1 commits)")[![zanechua](https://avatars.githubusercontent.com/u/4265429?v=4)](https://github.com/zanechua "zanechua (1 commits)")[![bboer](https://avatars.githubusercontent.com/u/2079578?v=4)](https://github.com/bboer "bboer (1 commits)")[![buismaarten](https://avatars.githubusercontent.com/u/16333228?v=4)](https://github.com/buismaarten "buismaarten (1 commits)")[![emadruida](https://avatars.githubusercontent.com/u/547183?v=4)](https://github.com/emadruida "emadruida (1 commits)")[![evolve32](https://avatars.githubusercontent.com/u/155657413?v=4)](https://github.com/evolve32 "evolve32 (1 commits)")

---

Tags

hacktoberfestwebsocketWebSocketshybi

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/chrome-php-wrench/health.svg)

```
[![Health](https://phpackages.com/badges/chrome-php-wrench/health.svg)](https://phpackages.com/packages/chrome-php-wrench)
```

###  Alternatives

[cboden/ratchet

PHP WebSocket library

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

PHP WebSocket client/server library

5903.1M11](/packages/wrench-wrench)[ratchet/rfc6455

RFC6455 WebSocket protocol handler

23433.7M69](/packages/ratchet-rfc6455)[gos/web-socket-bundle

Symfony Web Socket Bundle

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

Websockets for PHP using Rx

34181.5k2](/packages/rx-websocket)[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)
