qlimix/validation
Composer 安装命令:
composer require qlimix/validation
包简介
Validate data individually or by set
关键字:
README 文档
README
Validate data individually or by set.
Install
Using Composer:
$ composer require qlimix/validation
usage
Example 1 Collection
[
{
"foo": "bar",
"foobar": {
"bar": 1,
"foo": "example"
}
},
{
"foo": "foo",
"foobar": {
"bar": 2,
"foo": "example1"
}
}
]
<?php use Qlimix\Validation\CollectionValidation; use Qlimix\Validation\Inspector\HashInspector; use Qlimix\Validation\Inspector\KeyInspector; use Qlimix\Validation\Key; $example1 = new CollectionValidation([ new HashInspector([new Key('foo', true, [])]), // add validators new KeyInspector('foobar', true, [ new HashInspector([ new Key('bar', true, []), // add validators new Key('foo', true, []), // add validators ]) ]) ]);
Example 2 key values
{
"foo": "foobar",
"foobar": {
"bar": 42,
"foo": "example2"
}
}
<?php use Qlimix\Validation\Inspector\HashInspector; use Qlimix\Validation\Inspector\KeyInspector; use Qlimix\Validation\InspectorValidation; use Qlimix\Validation\Key; $example2 = new InspectorValidation([ new HashInspector([new Key('foo', true, [])]), // add validators new KeyInspector('foobar', true, [ new HashInspector([ new Key('bar', true, []), // add validators new Key('bar', true, []), // add validators ]) ]) ]);
Testing
To run all unit tests locally with PHPUnit:
$ vendor/bin/phpunit
Quality
To ensure code quality run grumphp which will run all tools:
$ vendor/bin/grumphp run
Contributing
Please see CONTRIBUTING for details.
统计信息
- 总下载量: 6
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-06-15