PHPackages                             uniondrug/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. [Framework](/categories/framework)
4. /
5. uniondrug/server

ActiveLibrary[Framework](/categories/framework)

uniondrug/server
================

Uniondrug Server Component for uniondrug/framework

2.9.3(7y ago)01.8k2MITPHP

Since Jan 11Pushed 7y ago2 watchersCompare

[ Source](https://github.com/uniondrug/server)[ Packagist](https://packagist.org/packages/uniondrug/server)[ RSS](/packages/uniondrug-server/feed)WikiDiscussions 2.x Synced 4d ago

READMEChangelog (10)Dependencies (2)Versions (37)Used By (2)

UniondrugServer 基于Swoole的PHP应用服务器
=================================

[](#uniondrugserver-基于swoole的php应用服务器)

基于Phalcon的uniondrug/framework项目中，使用本应用服务器可以提高性能。

安装
--

[](#安装)

```
$ composer requre uniondrug/server
$ cp vendor/uniondrug/server/server.php.example config/server.php

```

使用
--

[](#使用)

```
$ php server --help
   __  __      _             ____
  / / / /___  (_)___  ____  / __ \_______  ______ _
 / / / / __ \/ / __ \/ __ \/ / / / ___/ / / / __ `/
/ /_/ / / / / / /_/ / / / / /_/ / /  / /_/ / /_/ /
\____/_/ /_/_/\____/_/ /_/_____/_/   \__,_/\__, /
                                          /____/   Server 1.0.0
Usage:
 server [command] [option]

Options:
  -d, --daemon   Run server as daemon, Do not ask any interactive question
  -t, --path     Web root relative path. Default: /path/to/current/workspace
  -e, --env      Environment. Default: development
  -h, --help     Show this help

Available commands:
  start   Start the server
  stop    Stop the server
  reload  Reload the server
  status  Show the server status [default]

```

配置
--

[](#配置)

`server.php` 中配置的是Swoole服务器的运行参数，详细参数请参考`swoole`文档：

```
return [
    'default'    => [
        'host'      => 'http://0.0.0.0:9527',
        'class'     => \Uniondrug\Server\Servitization\Server\HTTPServer::class,
        'options'   => [
            'pid_file'        => __DIR__ . '/../tmp/pid/server.pid',
            'worker_num'      => 1,
            'task_worker_num' => 1,
        ],
        'processes' => [],
        'listeners' => [
            [
                'class' => \Uniondrug\Server\Servitization\Server\ManagerServer::class,
                'host'  => 'tcp://0.0.0.0:9530',
            ],
        ],
    ],
    'development' => [
        'autoreload' => true,
        'processes' => [
                // 开发环境，自动监控文件改动，改动后自动Reload服务
                \Uniondrug\Server\Processes\ReloadProcess::class,
        ],
    ],
    'production' => [
        'options' => [
            'worker_num' => 5,
        ],
    ],
];
```

### 数据库

[](#数据库)

Swoole的Worker会保持数据库的长连接，如果长时间服务器没有请求发生，可能会出现数据库服务器断开连接的情况。

可以通过在数据库的配置文件，增加一个参数，启动定时器来让worker进程与数据库服务器保持心跳。配置文件：`database.php`，配置参数 `interval`。参数为0时不启动定时器，大于0时，作为心跳间隔，单位：秒。

```
return [
    'default'    => [
        'adapter'    => 'mysql',
        'debug'      => true,
        'useSlave'   => false,
        'interval'   => 0,
        'connection' => [
            'host'     => '127.0.0.1',
            'port'     => 3306,
            'username' => 'root',
            'password' => '',
            'dbname'   => 'dbname',
            'charset'  => 'utf8',
        ],
    ],
];
```

### 任务分发

[](#任务分发)

### 进程管理

[](#进程管理)

### 进程间通信

[](#进程间通信)

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity75

Established project with proven stability

 Bus Factor1

Top contributor holds 92.6% 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

Every ~8 days

Recently: every ~20 days

Total

36

Last Release

2746d ago

Major Versions

1.10 → 2.02018-02-27

PHP version history (2 changes)1.0PHP &gt;=7.0

1.7PHP &gt;=7.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/865ceb7d8226574735eab8fc82de9cfbc4a708c291b3c816e75d53944348b686?d=identicon)[wsfuyibing](/maintainers/wsfuyibing)

---

Top Contributors

[![xueron](https://avatars.githubusercontent.com/u/2560873?v=4)](https://github.com/xueron "xueron (63 commits)")[![fuyibing](https://avatars.githubusercontent.com/u/8390620?v=4)](https://github.com/fuyibing "fuyibing (5 commits)")

### Embed Badge

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

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

###  Alternatives

[laravel/telescope

An elegant debug assistant for the Laravel framework.

5.2k67.8M192](/packages/laravel-telescope)[spiral/roadrunner

RoadRunner: High-performance PHP application server and process manager written in Go and powered with plugins

8.4k12.2M84](/packages/spiral-roadrunner)[nolimits4web/swiper

Most modern mobile touch slider and framework with hardware accelerated transitions

41.8k177.2k1](/packages/nolimits4web-swiper)[laravel/dusk

Laravel Dusk provides simple end-to-end testing and browser automation.

1.9k36.7M259](/packages/laravel-dusk)[laravel/prompts

Add beautiful and user-friendly forms to your command-line applications.

708181.8M596](/packages/laravel-prompts)[cakephp/chronos

A simple API extension for DateTime.

1.4k47.7M121](/packages/cakephp-chronos)

PHPackages © 2026

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