gnugat / ordono
此包已废弃,不再维护。未建议替代包。
简单的输入验证
v1.0.0
2014-08-26 21:56 UTC
Requires
- php: >=5.3.3
- symfony/options-resolver: ~2.0
Requires (Dev)
- phpspec/phpspec: ~2.0
- phpunit/phpunit: >=3.7,<5.0
- symfony/http-foundation: ~2.0
This package is not auto-updated.
Last update: 2022-02-01 12:38:51 UTC
README
简单的输入验证。
您将不再需要执行以下操作
if (!isset($input['content'])) { throw new \RuntimeException('The required option "content" is missing.'); } if (!is_string($input['content'])) { throw new \RuntimeException('The option "content" is expected to be of type "string"'); } if (!isset($input['author'])) { throw new \RuntimeException('The required option "author" is missing.'); } if (!is_string($input['author'])) { throw new \RuntimeException('The option "author" is expected to be of type "string"'); }
使用Ordono,保持验证的清洁
use Gnugat\Ordono\CommandResolver; $command = new CreateQuoteCommand(); // Definition of a valid input $commandResolver = new CommandResolver(); // $commandResolver->addConverter(new Symfony2RequestConverter()); $commandResolver->resolve($command, $input); // Throws exceptions if something is wrong
安装
使用 Composer 在项目中安装Ordono
composer require gnugat/ordono:~1.0
进一步文档
您可以使用以下方法查看当前和过去版本:
- 使用
git tag
命令 - GitHub上的发布页面
- 列出版本之间变更的文件变更日志
您可以在以下链接中找到更多文档: