--- name: hyperf description: "Hyperf 3.1 framework development assistant. Use when the user needs to: (1) Create Hyperf controllers, (2) Create Hyperf models, (3) Create Hyperf commands, (4) Implement services, (5) Configure routes, (6) Use dependency injection, (7) Handle validation, or any other Hyperf 3.1 development tasks. Triggers on phrases like \"创建 Hyperf 控制器\", \"生成模型\", \"创建命令\", \"Hyperf 开发\"." --- # Hyperf 3.1 开发指南 Hyperf 3.1 框架开发助手,专注于控制器、模型、命令行工具的快速开发。 ## 常用命令 ```bash # 生成控制器 php bin/hyperf.php gen:controller UserController # 生成模型 php bin/hyperf.php gen:model User # 生成命令 php bin/hyperf.php gen:command ImportCommand # 生成中间件 php bin/hyperf.php gen:middleware AuthMiddleware # 生成请求验证类 php bin/hyperf.php gen:request UserRequest # 启动服务 php bin/hyperf.php start ``` ## 快速示例 ### 控制器 ```php response->json(['code' => 0, 'data' => []]); } } ``` ### 模型 ```php info('Processing...'); } } ``` ### 服务类 ```php