PHPackages                             nextqs/php-socket-io-event-emitter - 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. nextqs/php-socket-io-event-emitter

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

nextqs/php-socket-io-event-emitter
==================================

PHP SocketIO Client - Yii2 Framework

04.8k↓33.3%1PHP

Since Sep 22Pushed 3y agoCompare

[ Source](https://github.com/nextqs/php-socket-io-event-emitter)[ Packagist](https://packagist.org/packages/nextqs/php-socket-io-event-emitter)[ RSS](/packages/nextqs-php-socket-io-event-emitter/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

PHP Socket Client
=================

[](#php-socket-client)

v.0.1.2

Fork from : `https://github.com/psinetron/PHP_SocketIO_Client`

***install***

```
php composer require nextqs/php-socket-io-event-emitter

```

**1 - YII2 Framework**
----------------------

[](#1---yii2-framework)

***web.php***

```
$config = [
    ...
    'components' => [
        ...,
        //socketioClient
        'socketioClient' => [
            'class' => 'nextqs\socketio\SocketIO',
        ],
        ...
    ],
]
```

***Use Component***

```
// Create socketio client
$objClient = new \Yii::$app->socketioClient("localhost", 8080);
// set query params
$objClient->setQueryParams([
      'param1' => 'value'
   ]);
// set namespace
$objClient->setNamespace('worker');
// send data
$success = $objClient->emit('msg', [
    'action' => 'test_action',
    'payload' => [
        'data' => [
            'key' => 'value
        ]
    ]
]);

return $success;
```

**2 - TESTS**
-------------

[](#2---tests)

***Php***

```
require_once '../src/SocketIO.php';

$client = new SocketIO('localhost', 9001);

$client->setNamespace('worker');

//connection handshake query( for auth - optional)
$client->setQueryParams([
    'token' => 'edihsudshuz',
    'id' => '8780',
    'cid' => '344',
    'cmp' => 2339
]);

$success = $client->emit('eventFromPhp', [
    'name' => 'Goku',
    'age' => '23',
    'address' => 'Sudbury, On, Canada'
]);

if(!$success)
{
    var_dump($client->getErrors());
}
else{
    var_dump("Success");
}
```

***Node Js***

```
var app = require('http').createServer(handler)
   var io = require('socket.io')(app);
   var fs = require('fs');

   const nspWorker = io.of('/worker')

   app.listen(9001);

   function handler (req, res) {
       res.writeHead(200);
       res.end('Hello Word');
   }

   nspWorker.on('connection', function (socket) {

       console.log("New Connection with transport", socket.conn.transport.name);

       console.log('With handshake', socket.handshake);

       console.log('With query', socket.handshake.query);

       socket.on('eventFromPhp', function (data) {
           console.log('Data from Php', data, JSON.parse(data));
       });
   });

```

**3 - API**
-----------

[](#3---api)

***.`setMaxRetry(n)`***

```
$client->setMaxRetry(10);//default 5

```

***.`setRetryInterval(interval)`***

```
$client->setRetryInterval(100);// 100 ms, default 200

```

***.`setProtocol(protocol)`***

```
$client->setProtocol(SocketIO::NO_SECURE_PROTOCOLE);
$client->setProtocol(SocketIO::TLS_PROTOCOLE);
$client->setProtocol(SocketIO::SSL_PROTOCOLE);

```

***.`setHost(host)`***

```
$client->setHost('localhost');

```

***.`setPort(port)`***

```
$client->setPort(80);

```

***.`setPath(path)`***

```
$client->setPath('/socket.io/?EIO=4');

```

***.`setNamespace(namespace)`***

```
$client->setNamespace('worker');

```

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity27

Early-stage or recently created project

 Bus Factor2

2 contributors hold 50%+ of commits

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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/34106284?v=4)[NextQs](/maintainers/nextqs)[@nextqs](https://github.com/nextqs)

---

Top Contributors

[![psinetron](https://avatars.githubusercontent.com/u/3624600?v=4)](https://github.com/psinetron "psinetron (15 commits)")[![MarceloMelo1](https://avatars.githubusercontent.com/u/10995789?v=4)](https://github.com/MarceloMelo1 "MarceloMelo1 (12 commits)")[![touskar](https://avatars.githubusercontent.com/u/13134736?v=4)](https://github.com/touskar "touskar (6 commits)")[![bitkill](https://avatars.githubusercontent.com/u/5882528?v=4)](https://github.com/bitkill "bitkill (1 commits)")

### Embed Badge

![Health badge](/badges/nextqs-php-socket-io-event-emitter/health.svg)

```
[![Health](https://phpackages.com/badges/nextqs-php-socket-io-event-emitter/health.svg)](https://phpackages.com/packages/nextqs-php-socket-io-event-emitter)
```

PHPackages © 2026

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