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.9.2(1mo ago)694.6M↓19.1%144MITPHPPHP ^7.4.15 || ^8.0.2CI passing

Since Aug 15Pushed 1mo 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.9 Synced 2w ago

READMEChangelog (10)Dependencies (8)Versions (25)Used By (4)

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(5.0)[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

66

—

FairBetter than 99% of packages

Maintenance91

Actively maintained with recent releases

Popularity58

Moderate usage in the ecosystem

Community36

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 62.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 ~77 days

Recently: every ~0 days

Total

24

Last Release

43d 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 (63 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

[composer/composer

Composer helps you declare, manage and install dependencies of PHP projects. It ensures you have the right stack everywhere.

29.5k199.6M3.4k](/packages/composer-composer)[symfony/http-kernel

Provides a structured process for converting a Request into a Response

8.1k886.6M9.7k](/packages/symfony-http-kernel)[symfony/http-client

Provides powerful methods to fetch HTTP resources synchronously or asynchronously

2.0k347.8M5.6k](/packages/symfony-http-client)[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.7k39.6k](/packages/matomo-matomo)[ratchet/rfc6455

RFC6455 WebSocket protocol handler

23644.4M83](/packages/ratchet-rfc6455)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

762297.9k53](/packages/civicrm-civicrm-core)

PHPackages © 2026

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