PHPackages                             limingxinleo/swoft-project - 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. limingxinleo/swoft-project

ActiveProject[Framework](/categories/framework)

limingxinleo/swoft-project
==========================

Modern High performance AOP and Coroutine PHP Framework, base on Swoole 2

1.4.7(7y ago)15155[1 issues](https://github.com/limingxinleo/swoft-project/issues)Apache-2.0PHPPHP &gt;=7.1

Since Jul 1Pushed 7y ago2 watchersCompare

[ Source](https://github.com/limingxinleo/swoft-project)[ Packagist](https://packagist.org/packages/limingxinleo/swoft-project)[ RSS](/packages/limingxinleo-swoft-project/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (1)Dependencies (31)Versions (11)Used By (0)

 [ ![swoft](https://camo.githubusercontent.com/f4c98bd65eb1f127c454ec92ffd11922481bbbd5a43e03facfa9a73e318bc89f/687474703a2f2f71696e69752e646179646179676f2e746f702f73776f66742d6c6f676f2e706e673f696d61676556696577322f322f772f333030) ](https://github.com/swoft-cloud/swoft)

[![Latest Version](https://camo.githubusercontent.com/170987d9f885da56ed9ba5d7bba8d45e3c6a2be63853012740b5497ce7e772cf/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f626574612d76312e302e302d677265656e2e7376673f6d61784167653d32353932303030)](https://github.com/swoft-cloud/swoft/releases)[![Build Status](https://camo.githubusercontent.com/e304d836e9fd2b03a61cc3b6d8cefc60100cf67d7cf1773cf8c080d694f6d6e3/68747470733a2f2f7472617669732d63692e6f72672f73776f66742d636c6f75642f73776f66742e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/swoft-cloud/swoft)[![Build Status](https://camo.githubusercontent.com/4eda5df8ac0be82f2c21fc541c331bbab3cc4e07daf1c524c98294a08b77c4bb/68747470733a2f2f7472617669732d63692e6f72672f6c696d696e6778696e6c656f2f73776f66742d70726f6a6563742d746573742e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/limingxinleo/swoft-project-test)[![Php Version](https://camo.githubusercontent.com/5127919eba34cfd4efa2e1d76a62f25de4061ec0a31a434fd9b23f6b16fc2c0e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d2533453d372e302d627269676874677265656e2e7376673f6d61784167653d32353932303030)](https://secure.php.net/)[![Swoole Version](https://camo.githubusercontent.com/3f995e37a7a1362664bf711caed364c2df6fb0428c5fb8d2fc872fe923bb93c7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f73776f6f6c652d2533453d322e312e312d627269676874677265656e2e7376673f6d61784167653d32353932303030)](https://github.com/swoole/swoole-src)[![Hiredis Version](https://camo.githubusercontent.com/be6ca7bef471189f85bdf9c59fc3e27a253b434af89740259514157cb173f433/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f686972656469732d2533453d302e312d627269676874677265656e2e7376673f6d61784167653d32353932303030)](https://github.com/redis/hiredis)[![Swoft Doc](https://camo.githubusercontent.com/ea1431167b522b88916c717b0bfe6348328a8662a684bb128f0b0bd6d22a20d5/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f646f63732d70617373696e672d677265656e2e7376673f6d61784167653d32353932303030)](https://doc.swoft.org)[![Swoft License](https://camo.githubusercontent.com/1c419f89412ea6c234c184ad6d85decb127c18584858d3707ae7d8e2131eccc4/68747470733a2f2f696d672e736869656c64732e696f2f686578706d2f6c2f706c75672e7376673f6d61784167653d32353932303030)](https://github.com/swoft-cloud/swoft/blob/master/LICENSE)

简介
==

[](#简介)

首个基于 Swoole 原生协程的新时代 PHP 高性能协程全栈组件化框架，内置协程网络服务器及常用的协程客户端，常驻内存，不依赖传统的 PHP-FPM，全异步非阻塞 IO 实现，以类似于同步客户端的写法实现异步客户端的使用，没有复杂的异步回调，没有繁琐的 yield，有类似 Go 语言的协程、灵活的注解、强大的全局依赖注入容器、完善的服务治理、灵活强大的 AOP、标准的 PSR 规范实现等等，可以用于构建高性能的Web系统、API、中间件、基础服务等等。

- 基于 Swoole 扩展
- 内置协程 HTTP, TCP, WebSocket 网络服务器
- 强大的 AOP (面向切面编程)
- 灵活完善的注解功能
- 全局的依赖注入容器
- 基于 PSR-7 的 HTTP 消息实现
- 基于 PSR-14 的事件管理器
- 基于 PSR-15 的中间件
- 基于 PSR-16 的缓存设计
- 可扩展的高性能 RPC
- 完善的服务治理，熔断，降级，负载，注册与发现
- 数据库 ORM
- 通用连接池
- 协程 Mysql, Redis, RPC, HTTP 客户端
- 协程和同步阻塞客户端无缝自动切换
- 协程、异步任务投递
- 自定义用户进程
- RESTful 支持
- 国际化(i18n)支持
- 高性能路由
- 快速灵活的参数验证器
- 别名机制
- 强大的日志系统
- 跨平台热更新自动 Reload

文档
==

[](#文档)

[**中文文档**](https://doc.swoft.org)

QQ 交流群: 548173319

环境要求
====

[](#环境要求)

1. PHP 7.0 +
2. [Swoole 2.1.1](https://github.com/swoole/swoole-src/releases) +, 需开启协程和异步Redis
3. [Hiredis](https://github.com/redis/hiredis/releases)
4. [Composer](https://getcomposer.org/)

安装
==

[](#安装)

手动安装
----

[](#手动安装)

- Clone 项目
- 安装依赖 `composer install`

Composer 安装
-----------

[](#composer-安装)

- `composer create-project swoft/swoft swoft`

Docker 安装
---------

[](#docker-安装)

- `docker run -p 80:80 swoft/swoft`

Docker-Compose 安装
-----------------

[](#docker-compose-安装)

- `cd swoft`
- `docker-compose up`

配置
==

[](#配置)

若在执行 `composer install` 的时候由程序自动复制环境变量配置文件失败，则可手动复制项目根目录的 `.env.example` 并命名为 `.env`，注意在执行 `composer update` 时并不会触发相关的复制操作

```
# Server
PFILE=/tmp/swoft.pid
PNAME=php-swoft
TCPABLE=true
CRONABLE=false
AUTO_RELOAD=true

# HTTP
HTTP_HOST=0.0.0.0
HTTP_PORT=80

# WebSocket
WS_ENABLE_HTTP=true

# TCP
TCP_HOST=0.0.0.0
TCP_PORT=8099
TCP_PACKAGE_MAX_LENGTH=2048
TCP_OPEN_EOF_CHECK=false

# Crontab
CRONTAB_TASK_COUNT=1024
CRONTAB_TASK_QUEUE=2048

# Settings
WORKER_NUM=1
MAX_REQUEST=10000
DAEMONIZE=0
DISPATCH_MODE=2
LOG_FILE=@runtime/swoole.log
TASK_WORKER_NUM=1

```

管理
--

[](#管理)

### 帮助命令

[](#帮助命令)

```
[root@swoft]# php bin/swoft -h
 ____                __ _
/ ___|_      _____  / _| |_
\___ \ \ /\ / / _ \| |_| __|
 ___) \ V  V / (_) |  _| |_
|____/ \_/\_/ \___/|_|  \__|

Usage:
  php bin/swoft {command} [arguments ...] [options ...]

Commands:
  entity  The group command list of database entity
  gen     Generate some common application template classes
  rpc     The group command list of rpc server
  server  The group command list of http-server
  ws      There some commands for manage the webSocket server

Options:
  -v, --version  show version
  -h, --help     show help

```

HTTP Server启动
-------------

[](#http-server启动)

> 是否同时启动RPC服务器取决于.env文件配置

```
// 启动服务，根据 .env 配置决定是否是守护进程
php bin/swoft start

// 守护进程启动，覆盖 .env 守护进程(DAEMONIZE)的配置
php bin/swoft start -d

// 重启
php bin/swoft restart

// 重新加载
php bin/swoft reload

// 关闭服务
php bin/swoft stop
```

### WebSocket Server启动

[](#websocket-server启动)

启动WebSocket服务器,可选是否同时支持http处理

```
// 启动服务，根据 .env 配置决定是否是守护进程
php bin/swoft ws:start

// 守护进程启动，覆盖 .env 守护进程(DAEMONIZE)的配置
php bin/swoft ws:start -d

// 重启
php bin/swoft ws:restart

// 重新加载
php bin/swoft ws:reload

// 关闭服务
php bin/swoft ws:stop
```

RPC Server启动
------------

[](#rpc-server启动)

> 启动独立的RPC服务器

```
// 启动服务，根据 .env 配置决定是否是守护进程
php bin/swoft rpc:start

// 守护进程启动，覆盖 .env 守护进程(DAEMONIZE)的配置
php bin/swoft rpc:start -d

// 重启
php bin/swoft rpc:restart

// 重新加载
php bin/swoft rpc:reload

// 关闭服务
php bin/swoft rpc:stop
```

更新日志
====

[](#更新日志)

[更新日志](changelog.md)

协议
==

[](#协议)

Swoft 的开源协议为 Apache-2.0，详情参见[LICENSE](LICENSE)

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity63

Established project with proven stability

 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

Every ~24 days

Recently: every ~12 days

Total

9

Last Release

2670d ago

Major Versions

1.4.5 → 2.x-dev2018-12-24

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

1.3.13PHP &gt;=7.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/e427ffcc825cdaf0253c4f8c212a6d6da66dce645f7a49316fbe63d18f7ca5e9?d=identicon)[limingxinleo](/maintainers/limingxinleo)

---

Top Contributors

[![limingxinleo](https://avatars.githubusercontent.com/u/16648551?v=4)](https://github.com/limingxinleo "limingxinleo (164 commits)")

---

Tags

phpprojectswoftswoolephpswooleswoft

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/limingxinleo-swoft-project/health.svg)

```
[![Health](https://phpackages.com/badges/limingxinleo-swoft-project/health.svg)](https://phpackages.com/packages/limingxinleo-swoft-project)
```

###  Alternatives

[swoft/swoft

Modern High performance AOP and Coroutine PHP Framework

5.6k34.4k](/packages/swoft-swoft)[swoft/framework

swoft framework component

64181.4k85](/packages/swoft-framework)

PHPackages © 2026

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