qlimix / validation
Validate data individually or by set
Installs: 6
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/qlimix/validation
Requires
- php: >7.4
Requires (Dev)
- infection/infection: ^0.21
- qlimix/code-standard: ^3.0
This package is auto-updated.
Last update: 2025-10-23 06:27:18 UTC
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.