PHPackages                             zxzgit/swoole-socket-distributor - 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. zxzgit/swoole-socket-distributor

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

zxzgit/swoole-socket-distributor
================================

v1.0(7y ago)07PHP

Since Jan 24Pushed 7y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (3)Used By (0)

swoole-socket-distributor
=========================

[](#swoole-socket-distributor)

基于 swoole 的 Swoole\\Server 内容分发，可以将接受的信息分发到模块和控制器。

\#基本用法

基本构建使用参考test目录：

```
--testapp
  --controllers
    --IndexController.php
    --OtherController.php
  --modules
    --test  //test module name
       --controllers
         --IndexController.php
         --OtherController.php
       --MessageModule.php
  --public
    --indexTest.php
  --MessageDistributor.php

```

testapp/public/indexTest.php

```
//#`php indexTest.php` to start a websocket server
\zxzgit\ssd\zxzgit\WebSocketApp::run([
    //'serverBind' => '0.0.0.0',//default 0.0.0.0
    //'serverPort' => '9502',//default serverPort
    'moduleList' => [
        'test' => \testapp\test\modules\test\MessageModule::class,
    ],
    'messageDistributor' => \testapp\test\MessageDistributor::class,
    'event' => [
        'initConnector' => function () {

        },
        'workerStart' => function (&$server, $id) {
            echo PHP_EOL . "workerStart event" . PHP_EOL;
        },
        'open' => function (&$server, &$req) {
            echo PHP_EOL . "open event" . PHP_EOL;
        },
        'beforeMessage' => function (&$server, &$frame) {
            echo PHP_EOL . "beforeMessage event" . PHP_EOL;
        },
        'afterMessage' => function (&$server, &$frame) {
            echo PHP_EOL . "afterMessage event" . PHP_EOL;
        },
        'close' => function (&$server, $fd) {
            echo PHP_EOL . "afterMessage event" . PHP_EOL;
        },
    ]
]);

```

testapp/controllers/IndexController.php

```
class IndexController extends \zxzgit\ssd\libs\AbstractController {
    //clien send json data {"route":"index/index","data":{"key1":"value1"}} can route to this action method
    public function actionIndex(){
        return $this->pushMsg(['hello', 'world']);
    }
}

```

testapp/MessageDistributor.php

```
class MessageDistributor extends \zxzgit\ssd\libs\MessageDistributor{
    public $moduleList = [
        //'test' => \zxzgit\ssd\test\modules\test\MessageModule::class,
    ];
}

```

testapp/modules/test/MessageModule.php

```
class MessageModule extends \zxzgit\ssd\libs\MessageModule{}

```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity61

Established project with proven stability

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

2662d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3e6b716063f6719eb0cb3ea8832c27ffedc0b95cfd490dfac981ff01ada270f1?d=identicon)[zxzgit](/maintainers/zxzgit)

### Embed Badge

![Health badge](/badges/zxzgit-swoole-socket-distributor/health.svg)

```
[![Health](https://phpackages.com/badges/zxzgit-swoole-socket-distributor/health.svg)](https://phpackages.com/packages/zxzgit-swoole-socket-distributor)
```

###  Alternatives

[friendsofsymfony/rest-bundle

This Bundle provides various tools to rapidly develop RESTful API's with Symfony

2.8k73.3M317](/packages/friendsofsymfony-rest-bundle)[php-http/discovery

Finds and installs PSR-7, PSR-17, PSR-18 and HTTPlug implementations

1.3k309.5M1.2k](/packages/php-http-discovery)[nyholm/psr7

A fast PHP7 implementation of PSR-7

1.3k235.4M2.4k](/packages/nyholm-psr7)[pusher/pusher-php-server

Library for interacting with the Pusher REST API

1.5k94.8M292](/packages/pusher-pusher-php-server)[spatie/crawler

Crawl all internal links found on a website

2.8k16.3M52](/packages/spatie-crawler)[react/http

Event-driven, streaming HTTP client and server implementation for ReactPHP

78126.4M414](/packages/react-http)

PHPackages © 2026

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