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

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

reactificate/websocket
======================

Reactificate Websocket

0.10(4y ago)0767MITPHPPHP ^7.4 || ^8.0

Since May 29Pushed 4y ago1 watchersCompare

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

READMEChangelog (10)Dependencies (5)Versions (18)Used By (0)

Websocket
=========

[](#websocket)

Reactificate websocket wrapper around [react/http](https://reactphp.org/http).

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

[](#installation)

```
composer require reactificate/websocket

```

Usage
-----

[](#usage)

- Creating websocket server \[server.php\]

```
use React\EventLoop\Factory;
use React\Http\Server;
use Reactificate\Websocket\Middleware;
use Reactificate\Websocket\Prebuilt\Servers\ChatServer;

require 'vendor/autoload.php';

$loop = Factory::create();

$wsServers = Middleware::create(new ChatServer());

$socket = new \React\Socket\Server(8080, $loop);
$server = new Server($loop, ...$wsServers);
$server->listen($socket);

$loop->run();
```

- Download [socket.js](https://github.com/reactificate/reactificate/blob/master/public/socket.js) and include it in the code below
- Chat webpage \[index.html\]

```
>

    Chat

        Send

    const websocket = new Reactificate.WSClient('ws://127.0.0.1:8080/ws/chat');
    const elMessages = document.getElementById('messages');
    const inputUsername = document.getElementById('username');
    const textareaMessage = document.getElementById('message');

    websocket.onOpen(() => console.log('Connection established'))
    websocket.onClose(() => console.log('Connection closed'))
    websocket.onError((error) => console.log(error));

    websocket.onMessage(function (payload) {
        let message = JSON.parse(payload.data)
        if ('chat.message' === message.command) {
            let divMessage = document.createElement('div');
            let username = '' + message.data.username + ': ';
            divMessage.innerHTML = '' + username + message.data.message;
            elMessages.append(divMessage)
        }
    });

    document.getElementById('formSendMessage').onsubmit = function (event) {
        event.preventDefault();

        websocket.send('chat.message', {
            username: inputUsername.value,
            message: textareaMessage.value
        }).then(() => {
            textareaMessage.value = '';
        });
    };

```

- Start server

```
php server.php
```

- Run **index.html** in your browser and test

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

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 ~8 days

Recently: every ~17 days

Total

17

Last Release

1691d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8de4062b51f2645651337e8e80631befc8d1d1f5f5ad1ca4a388fa384d6e295b?d=identicon)[reactificate](/maintainers/reactificate)

###  Code Quality

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[nette/http

🌐 Nette Http: abstraction for HTTP request, response and session. Provides careful data sanitization and utility for URL and cookies manipulation.

48619.2M541](/packages/nette-http)[nette/routing

Nette Routing: two-ways URL conversion

25712.0M22](/packages/nette-routing)[contributte/apitte

An opinionated and enjoyable API framework based on Nette Framework. Supporting content negotiation, debugging, middlewares, attributes and loving openapi/swagger.

641.3M3](/packages/contributte-apitte)[discord-php/http

Handles HTTP requests to Discord servers

25318.7k8](/packages/discord-php-http)[contributte/psr7-http-message

PSR-7 (HTTP Message Interface) to Nette Framework

222.9M8](/packages/contributte-psr7-http-message)[contributte/guzzlette

Guzzle integration into Nette Framework

291.2M3](/packages/contributte-guzzlette)

PHPackages © 2026

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