PHPackages                             unntech/liteswoole - 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. unntech/liteswoole

ActiveProject[Framework](/categories/framework)

unntech/liteswoole
==================

A lite php Framework for Swoole provide API / WebSocket

v2.0.5(10mo ago)25MITPHPPHP &gt;=8.1

Since Jun 16Pushed 10mo agoCompare

[ Source](https://github.com/unntech/liteSwoole)[ Packagist](https://packagist.org/packages/unntech/liteswoole)[ Docs](https://github.com/unntech/liteSwoole)[ RSS](/packages/unntech-liteswoole/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (5)Dependencies (2)Versions (6)Used By (0)

liteSwoole 2.0
==============

[](#liteswoole-20)

[![Latest Stable Version](https://camo.githubusercontent.com/a4444e9caf65d050020943e0ab0d35be92ca51183e54fe2bef24d6f1dcb78379/68747470733a2f2f706f7365722e707567782e6f72672f756e6e746563682f6c69746573776f6f6c652f762f737461626c65)](https://packagist.org/packages/unntech/liteswoole)[![Total Downloads](https://camo.githubusercontent.com/1277c66bce9234453a8d3644eef186d909e7f47b047738afac6e40fbde3b9fe5/68747470733a2f2f706f7365722e707567782e6f72672f756e6e746563682f6c69746573776f6f6c652f646f776e6c6f616473)](https://packagist.org/packages/unntech/liteswoole)[![Latest Unstable Version](https://camo.githubusercontent.com/8de2bd30a90e188b8b77f2a427593ea0e1931ad1b4f894ed59c8aa39cae009d7/687474703a2f2f706f7365722e707567782e6f72672f756e6e746563682f6c69746573776f6f6c652f762f756e737461626c65)](https://packagist.org/packages/unntech/liteswoole)[![PHP Version Require](https://camo.githubusercontent.com/a7fdec0bdeffedab217617aa8ae4c9f79dc70cd56cad83168fcba1d79bf32635/687474703a2f2f706f7365722e707567782e6f72672f756e6e746563682f6c69746573776f6f6c652f726571756972652f706870)](https://packagist.org/packages/unntech/liteswoole)[![License](https://camo.githubusercontent.com/16679cfcf0befa034469e9e1281700b155dcbbe6a8c1e723a39f8b7ea2c665ee/68747470733a2f2f706f7365722e707567782e6f72672f756e6e746563682f6c69746573776f6f6c652f6c6963656e7365)](https://packagist.org/packages/unntech/liteswoole)

基于PHP Swoole 创建的协程框架，可用于生产环境的高性能API接口 和 WebSocket 连接。

主要新特性
-----

[](#主要新特性)

- 最为接近原生PHP写法，满足习惯原生开发的人员开发习惯
- 采用`PHP8`强类型（严格模式）
- 支持更多的`PSR`规范
- 原生多应用支持
- 对Swoole以及协程支持
- 对IDE更加友好
- 统一和精简大量用法

> liteSwoole 2.0的运行环境要求PHP8.1+ 需要安装 ext-swoole 扩展

安装
--

[](#安装)

```
composer create-project unntech/liteswoole yourApp

```

```
将目录config.sample 改名为 config，可以更据需求增加配置文件
读取例子见：tests/sample.config.php
docs/liteswoole.sql 导入至数据库

```

启动服务，可在 config/swoole.php `'services' => ['http', 'webSocket', 'task']` 配置需要启动的服务

```
cd yourApp
./ctl start    #chmod +x ctl 先赋予可执行权限

```

### Http 接口访问

[](#http-接口访问)

```
http://localhost:9898/authorize  #获取TOKEN

http://localhost:9898/index/index

```

```
访问的路径对应/app/controller/Http/文件名/函数名

```

### websocket连接

[](#websocket连接)

```
ws://localhost:9898

```

```
/app/controller/WebSocketOpen.php       # 处理连接事件
/app/controller/WebSocketClose.php      # 处理断线事件
/app/controller/WebSocket/文件名/函数名   # 按message里 head.uri 的路径对应解析

```

如果需要更新框架使用

```
composer update unntech/liphp

```

目录结构

```
yourApp/
├── app                                     #App命名空间
│   ├── controller                          #控制器方法目录
│   │   ├── Http                            #接口控制器目录，支持分项多级子目录
│   │   ├── WebSocket                       #WebSocket消息处理，支持分项多级子目录
│   │   ├── BootStrap.php                   #服务启动事件处理程序
│   │   ├── HttpAuthorizeRequest.php        #带验证access_token的Http请求父类
│   │   ├── WebSocketClose.php              #WebSocket Close处理类
│   │   └── WebSocketOpen.php               #WebSocket Open处理类
│   ├── framework                           #框架核心基础文件
│   │   ├── extend                          #继承vendor框架类，供扩展和重写方法
│   │   ├── AppBase.php                     #app基础父类
│   │   ├── HttpRequest.php                 #Http请求基础类
│   │   ├── LiApp.php                       #App通用类，入口初始化数据
│   │   ├── ModelBase.php                   #模型基础类
│   │   ├── Response.php                    #API 标准输出类
│   │   └── WebSocket.php                   #WebSocket请求基础类
│   ├── model                               #模型类
│   ├── structure                           #自定义的数据结构体
│   ├── traits
│   ├── ...                                 #其它子模块
├── config                                  #配置文件
│   ├── app.php                             #项目基础配置
│   ├── db.php                              #数据库配置文件
│   ├── redis.php                           #redis配置文件
│   ├── swoole.php                          #Http/WebSocket配置文件
├── docs                                    #文档
│   ├── liteswoole.sql.gz                   #LiteSwoole模块数据库
├── include                                 #通用函数库
│   ├── common.php                          #全局通用函数
├── log                                     #日志存放目录
├── app.php                                 #服务启动主程序
├── autoload.php                            #autoload载入主程序
├── CHANGELOG.md                            #版本更新日志
├── composer.json                           #
└── README.md

```

命名规范
----

[](#命名规范)

`LiteSwoole`遵循PSR命名规范和PSR-4自动加载规范。

参与开发
----

[](#参与开发)

直接提交PR或者Issue即可

> [版本更新记录 CHANGELOG](CHANGELOG.md)

版权信息
----

[](#版权信息)

liteSwoole遵循MIT开源协议发布，并提供免费使用。

本项目包含的第三方源码和二进制文件之版权信息另行标注。

版权所有Copyright © 2025 by Jason Lin All rights reserved。

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance54

Moderate activity, may be stable

Popularity7

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity49

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

Every ~4 days

Total

5

Last Release

308d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/41ed0737519313bb52a1c118a720dd65f4c238a2a805825eeef7bf2b41e05bfa?d=identicon)[unntech](/maintainers/unntech)

---

Top Contributors

[![unntech](https://avatars.githubusercontent.com/u/98684048?v=4)](https://github.com/unntech "unntech (9 commits)")

### Embed Badge

![Health badge](/badges/unntech-liteswoole/health.svg)

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

###  Alternatives

[laravel/telescope

An elegant debug assistant for the Laravel framework.

5.2k67.8M190](/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.7M255](/packages/laravel-dusk)[laravel/prompts

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

708181.8M591](/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)
