Skip to content

Commit 653e839

Browse files
committed
docs: 丰富示例项目 README,突出 4.0 亮点
1 parent 9967574 commit 653e839

1 file changed

Lines changed: 29 additions & 18 deletions

File tree

README.md

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,58 @@
1-
# HPlus App(测试示例项目
1+
# HPlus App(4.0 体验示例
22

3-
用于本地验证 HPlus 4.0 插件(route / validate / swagger)的示例项目。
3+
用于快速体验 / 验证 HPlus 4.0 三个核心插件:`route``validate``swagger`
4+
5+
## 主要亮点
6+
7+
- 🛣️ 路由 4.0:kebab-case URL、静态路由优先、精简 RESTful 映射
8+
- ✅ 验证 4.0:Query/Body 分离,支持 FormRequest,移除旧 Validate 基类
9+
- 📖 Swagger 4.0:懒加载 + 缓存,首访构建,后续极速返回
10+
- 🔄 一注解三件事:路由注册 + 参数验证 + 文档生成 同步完成
11+
12+
## 预置接口(`/test`
13+
14+
- `GET /test` 首页说明页(列出示例与特性)
15+
- `GET /test/get-test` Query 验证示例(page/size/keyword/status)
16+
- `POST /test/post-test` JSON 体验证示例(name/email/age)
17+
- `POST /test/form-test` 表单验证示例(mode: form)
18+
19+
> 所有接口都可在 Swagger 中直接试用:`/swagger`
420
521
## 环境要求
622

723
- PHP ≥ 8.1
824
- Hyperf ≥ 3.1
925
- 扩展:swoole、json、mbstring、pcntl
1026

11-
## 依赖安装
27+
## 快速开始
1228

1329
```bash
1430
composer install
15-
```
16-
17-
## 运行
18-
19-
```bash
2031
php bin/hyperf.php start
2132
```
2233

23-
启动后访问
24-
- 示例接口`http://localhost:9501/test`
25-
- Swagger 文档(依赖 swagger 插件)`http://localhost:9501/swagger`
34+
访问
35+
- 示例页`http://localhost:9501/test`
36+
- Swagger:`http://localhost:9501/swagger` (需安装 swagger 插件)
2637

2738
## 相关插件版本
2839

2940
| 插件 | 版本 | 说明 |
3041
|------|------|------|
31-
| hyperf-plus/route | ^4.0 | 路由 4.0(kebab-case、静态路由优先 |
32-
| hyperf-plus/validate | ^4.0 | 验证 4.0(FormRequest、Query/Body 分离 |
33-
| hyperf-plus/swagger | ^4.0 | Swagger 4.0(懒加载+缓存,OpenAPI 3.1.1 |
42+
| hyperf-plus/route | ^4.0 | kebab-case、静态路由优先 |
43+
| hyperf-plus/validate | ^4.0 | Query/Body 分离,FormRequest |
44+
| hyperf-plus/swagger | ^4.0 | 懒加载+缓存,OpenAPI 3.1.1 |
3445

3546
## 常用命令
3647

3748
```bash
38-
# 启动服务
49+
# 启动
3950
php bin/hyperf.php start
4051

41-
# 运行测试
52+
# 测试
4253
composer test
4354
```
4455

45-
## 注意
56+
## 说明
4657

47-
本项目仅用于 4.0 功能验证,不建议直接用于生产。
58+
本项目仅用于 4.0 功能验证,便于大家试用,不建议直接用于生产。

0 commit comments

Comments
 (0)