PHPackages                             axguowen/think-socket-business - 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. axguowen/think-socket-business

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

axguowen/think-socket-business
==============================

Socket Business Service For ThinkPHP

044PHP

Since Apr 1Pushed 1y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

ThinkPHP Socket Business 服务
===========================

[](#thinkphp-socket-business-服务)

一个简单的ThinkPHP Socket扩展中的Business服务 本服务主要负责业务处理

安装
--

[](#安装)

```
composer require axguowen/think-socket-business

```

配置
--

[](#配置)

首先配置config目录下的socketbusiness.php配置文件。 配置项说明：

```
return [
    // Business进程名称, 方便status命令中查看统计
    'name' => 'think-socket-business',
    // BusinessWorker进程数量, 根据业务是否有阻塞式IO设置进程数为CPU核数的1倍-4倍即可。
    'count' => 2,
    // 注册服务地址, 格式类似于 '127.0.0.1:1236'。
    // 如果是部署了多个register服务则格式是数组，类似['192.168.0.1:1236','192.168.0.2:1236']
    'register_address' => '127.0.0.1:1236',
    // Gateway通讯密钥
    'secret_key' => '',
    // 业务处理类，业务类至少要实现onMessage静态方法，onConnect和onClose静态方法可以不用实现。
    'event_handler' => '',
    // 是否以守护进程启动
    'daemonize' => false,
];
```

启动停止
----

[](#启动停止)

定时任务的启动停止均在命令行控制台操作，所以首先需要在控制台进入tp目录

### 启动命令

[](#启动命令)

```
php think socket:business start

```

要使用守护进程模式启动可以将配置项deamonize设置为true 或者在启动命令后面追加 -d 参数，如下：

```
php think socket:business start -d

```

### 停止

[](#停止)

```
php think socket:business stop

```

### 查看进程状态

[](#查看进程状态)

```
php think socket:business status

```

注意
--

[](#注意)

Windows下不支持多进程设置，也不支持守护进程方式运行，正式生产环境请用Linux

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance35

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity15

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/5bb2b3388238042a25cf42dc44e5ff84adc241510354abae9e91573556753205?d=identicon)[axguowen](/maintainers/axguowen)

---

Top Contributors

[![axguowen](https://avatars.githubusercontent.com/u/61955804?v=4)](https://github.com/axguowen "axguowen (6 commits)")

### Embed Badge

![Health badge](/badges/axguowen-think-socket-business/health.svg)

```
[![Health](https://phpackages.com/badges/axguowen-think-socket-business/health.svg)](https://phpackages.com/packages/axguowen-think-socket-business)
```

###  Alternatives

[bitwasp/buffertools

Toolbox for working with binary and hex data. Similar to NodeJS Buffer.

65764.4k41](/packages/bitwasp-buffertools)[reefki/laravel-device-detector

Laravel wrapper for Matomo's Universal Device Detection library.

2852.6k](/packages/reefki-laravel-device-detector)

PHPackages © 2026

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