friendsofhyperf/command-validation
最新稳定版本:v3.2.0-alpha.6
Composer 安装命令:
composer require friendsofhyperf/command-validation
包简介
The command validation component for Hyperf.
README 文档
README
The command validation component for Hyperf.
Installation
composer require friendsofhyperf/command-validation
Usage
<?php declare(strict_types=1); namespace App\Command; use FriendsOfHyperf\CommandValidation\Traits\ValidatesInput; use Hyperf\Command\Command as HyperfCommand; use Hyperf\Command\Annotation\Command; #[Command] class FooCommand extends HyperfCommand { use ValidatesInput; /** * 执行的命令行 */ protected string $name = 'foo:hello {?name : The name of the person to greet.}'; public function handle() { $this->info(sprintf('Hello %s.', $this->input->getArgument('name'))); } protected function rules(): array { return [ 'name' => 'required', ]; } protected function messages(): array { return [ 'name.required' => 'The name is required.', ]; } }
Contact
License
统计信息
- 总下载量: 10
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-02-10