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(7y ago)224MITPHPPHP &gt;=7.0

Since Aug 15Pushed 7y 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 2w 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 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity57

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

2876d 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

25025.5M80](/packages/php-http-cache-plugin)[illuminate/http

The Illuminate Http package.

11937.2M6.6k](/packages/illuminate-http)[rdkafka/rdkafka

A PHP extension for Kafka

2.2k20.0k1](/packages/rdkafka-rdkafka)[httpsoft/http-message

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

87930.4k113](/packages/httpsoft-http-message)[mezzio/mezzio-router

Router subcomponent for Mezzio

265.3M84](/packages/mezzio-mezzio-router)[serpapi/google-search-results-php

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

69122.6k](/packages/serpapi-google-search-results-php)

PHPackages © 2026

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