PHPackages                             hannesvdvreken/socketio - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. hannesvdvreken/socketio

AbandonedLibrary[Utility &amp; Helpers](/categories/utility)

hannesvdvreken/socketio
=======================

Pushing Socket.io messages to Redis for socket.io's Redis socket manager.

1.0.0-alpha.1(11y ago)4272MITPHPPHP &gt;=5.4.0

Since Dec 26Pushed 11y ago1 watchersCompare

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

READMEChangelogDependencies (2)Versions (2)Used By (0)

Socket.io messages from PHP
===========================

[](#socketio-messages-from-php)

What does it do?
----------------

[](#what-does-it-do)

This package allows you to transfer socket message to a Node.js process via Redis. Socket.io has a redis adapter to allow scaling a Node.js cluster to send socket messages to any client connected to any process. We can use this to send messages straight from PHP.

This package provides a `Socketio\Socketio` class with similar methods as the socket.io server in Node.js such as `emit`, `in`, `to`, `of` and `adapter`.

Usage
-----

[](#usage)

First we can create a `Socketio\Socketio` object.

```
$io = new Socketio\Socketio;
```

It has some of the same methods as in Node.js:

### Namespace

[](#namespace)

```
$chats = $io->of('/chats');

$io->emit('general', $message);
$chats->emit('user.connected', $user);
```

Setup a server object with a different namespace. The `$io` object keeps the same namespace. Or use a callback:

```
$io->of('/chats', function ($chats) {
    $chats->emit('user.connected', $user);
});

$io->emit('general', $message);
```

### Rooms

[](#rooms)

Send to specific room(s):

```
$io->to('room-a')->emit('event', $message);
$io->to('room-a')->to('room-b')->emit('event', $message);
$io->in('room-c')->emit('event', $message);
```

Where `in` is an alias of `to`. You can send to several rooms at the same time by chaining `to` calls. The rooms are reset after every `emit` call. This is similar behaviour as in Node.js.

### Adapters

[](#adapters)

By default, the `Socketio\Socketio` object configures a `Memory` adapter. This adapter fakes socket message delivery and can be useful for testing/stubbing.

To setup the `Redis` adapter you need to configure some dependencies first.

```
$predis = new Predis\Client;
$msgpack = new Socketio\Utils\Msgpack;

$adapter = new Socketio\Adapters\Redis($predis, $msgpack);
$io->adapter($adapter);
```

If you have `ext-msgpack` installed, the Socketio\\Utils\\Msgpack will use the native `msgpack_pack` and `msgpack_unpack` methods which are supposed to be the fastest around.

If not, you can pass it `Msgpack\Encoder` and `Msgpack\Decoder` objects to do the encoding/decoding. These come pre-installed with composer if you require this package.

```
$msgpack = new Socketio\Utils\Msgpack(new Msgpack\Encoder, new Msgpack\Decoder);
```

The Node.js process
-------------------

[](#the-nodejs-process)

```
var app = require('express')();
var socketio = require('socket.io');
var adapter = require('socket.io-redis');

var server = app.listen(process.env.NODE_PORT || 9000);

io = socketio(server);
io.adapter(adapter());
```

Right now, you're good to go!

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

[](#contributing)

Stick to [PSR-2 Coding Standards](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)and be nice in communication.

License
-------

[](#license)

[MIT](license)

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

4152d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9937cd6d2eff58e99c75bc2d4a53066e7c9cfdec457c798d5d02d37e6947f419?d=identicon)[hannesvdvreken](/maintainers/hannesvdvreken)

---

Top Contributors

[![hannesvdvreken](https://avatars.githubusercontent.com/u/1410358?v=4)](https://github.com/hannesvdvreken "hannesvdvreken (9 commits)")

### Embed Badge

![Health badge](/badges/hannesvdvreken-socketio/health.svg)

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

###  Alternatives

[grumpydictator/firefly-iii

Firefly III: a personal finances manager.

22.8k69.3k](/packages/grumpydictator-firefly-iii)[blair2004/nexopos

The Free Modern Point Of Sale System build with Laravel, TailwindCSS and Vue.js.

1.2k2.3k](/packages/blair2004-nexopos)[php-junior/laravel-video-chat

Laravel Video Chat using Socket.IO and WebRTC

82018.1k](/packages/php-junior-laravel-video-chat)[vcian/pulse-active-sessions

A Laravel Pulse card to show active user session.

11469.2k](/packages/vcian-pulse-active-sessions)[splitsoftware/split-sdk-php

Split SDK for PHP

161.3M2](/packages/splitsoftware-split-sdk-php)[vwo/vwo-php-sdk

VWO server side sdk

12166.4k](/packages/vwo-vwo-php-sdk)

PHPackages © 2026

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