chrgriffin / laravel-strict-validator
'Strict' validator for PHP arrays. Currently only supported in Laravel.
v1.0.2
2018-05-15 17:08 UTC
Requires
- php: >=7.0
- illuminate/validation: ~5.6.21
This package is auto-updated.
Last update: 2024-12-23 08:29:19 UTC
README
'Strict' validator for PHP arrays. Currently only supported in Lumen/Laravel as it uses the Laravel validation implementation. Use this package to add 'strict' validation in addition to the normal Laravel validation rules.
'Strict' Rules
- Arrays can only contain fields under validation. Any 'extra' indexes will cause the validator to return
false.
- to be continued..?
Installation
composer require chrgriffin/laravel-strict-validator
Usage
use ChrGriffin\StrictValidator;
$validator = new StrictValidator(
$dataToValidate,
[
'foo' => 'string|required',
'bar' => 'array|required',
'bar.inner' => 'string|required'
]
);
$valid = $validator->validate();