Looking to hire Laravel developers? Try LaraJobs

laravel-strict-validator maintained by chrgriffin

Description
'Strict' validator for PHP arrays. Currently only supported in Laravel.
Last update
2018/05/15 19:08 (dev-master)
License
Links
Downloads
153

Comments
comments powered by Disqus

'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

  1. Arrays can only contain fields under validation. Any 'extra' indexes will cause the validator to return false.
  2. 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();