p4bloch/console-validable-question
最新稳定版本:0.1.0
Composer 安装命令:
composer require p4bloch/console-validable-question
包简介
Easily Validate Questions in Symfony/Console
README 文档
README
#ValidableQuestion Easily validate a Symfony/Console Question.
Usage
$question = new ValidableQuestion('Who are you?', ['required']); $question = new ValidableQuestion('How old are you?', ['numeric'], 25); $question = new ValidableQuestion('Enter your e-mail', ['required', 'email']); $helper->ask($input, $output, $question);
Why?
Validating a Question in Symfony/Console involves calling setValidator on each Question and passing the function that will actually validate it as an argument, which is awesome when you need to do a somehow complex validation, but quite annoying when you simply want to check if the value is not null, or a number, or an e-mail, etc.
ValidableQuestion extends Console's Question, but validates the answer against any rules specified in the background, leaving you with a nice and readable one liner.
统计信息
- 总下载量: 19
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2014-12-23