PHPackages                             fxj/swoole\_server - 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. fxj/swoole\_server

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

fxj/swoole\_server
==================

Swoole Websocket Server

1.0(8y ago)224MITPHPPHP &gt;=7.0

Since Aug 15Pushed 8y agoCompare

[ Source](https://github.com/king-fang/momo_swoole_server)[ Packagist](https://packagist.org/packages/fxj/swoole_server)[ RSS](/packages/fxj-swoole-server/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependenciesVersions (2)Used By (0)

momo\_swoole\_server
====================

[](#momo_swoole_server)

[Swoole](https://www.swoole.com)

websocket/http/tcp/upd
======================

[](#websockethttptcpupd)

1. websocket服务器也可以同时作为http服务器，设置了onRequest回调即可,默认开启
2. 自定义的回调类必须是继承*SwooleCallback*和实现对应的接口
3. 回调接口：*ISwooleUdpCallback*,*ISwooleWebsocketCallback*,*ISwooleCallback*
4. 当前服务器的*server*可以通过构造函数在回调的构造函数中获取\*\_\_construct($server)\* 获取,将其设置为成员属性即可

\#Start

```
/**
 * 初始化
 * TmSwoolerServer constructor.
 * @param string $host  IP/域名
 * @param int $port  端口
 * @param string $server_type 服务器类型tcp/udp/websocket
 * @param string $model 运行模式 process|base
 */
$client = new \Server\TmSwoolerServer('127.0.0.1',9502,'websocket');

//设置参数
$client->setOption(array(
    'reactor_num' => 2,
    'worker_num' => 4,
    'backlog' => 128,
    'max_request' => 50,
    'dispatch_mode' => 1,
));
//设置回调
$client->callback(\Server\Callback\SwooleWebsocketCallback::class);
//启动
$client->ServerStart();

```

###  Health Score

26

—

LowBetter than 40% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity58

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

2921d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/29619744?v=4)[fxj](/maintainers/king-fang)[@king-fang](https://github.com/king-fang)

---

Top Contributors

[![sublimesub](https://avatars.githubusercontent.com/u/18398740?v=4)](https://github.com/sublimesub "sublimesub (2 commits)")

### Embed Badge

![Health badge](/badges/fxj-swoole-server/health.svg)

```
[![Health](https://phpackages.com/badges/fxj-swoole-server/health.svg)](https://phpackages.com/packages/fxj-swoole-server)
```

###  Alternatives

[php-http/cache-plugin

PSR-6 Cache plugin for HTTPlug

25026.8M85](/packages/php-http-cache-plugin)[httpsoft/http-message

Strict and fast implementation of PSR-7 and PSR-17

85997.3k126](/packages/httpsoft-http-message)[serpapi/google-search-results-php

Get Google, Bing, Baidu, Ebay, Yahoo, Yandex, Home depot, Naver, Apple, Duckduckgo, Youtube search results via SerpApi.com

69131.6k](/packages/serpapi-google-search-results-php)[thesis/nats

Async (fiber based) client for Nats.

758.3k](/packages/thesis-nats)

PHPackages © 2026

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