tinylara/tinyvalidator

Tiny PHP validator.

v1.2 2015-03-18 02:29 UTC

This package is not auto-updated.

Last update: 2024-11-23 18:07:05 UTC


README

Latest Stable Version Total Downloads License

TinyValidator is a tiny validation package. Read the documentation.

Install

If you have Composer, just include TinyValidator as a project dependency in your composer.json. If you don't just install it by downloading the .ZIP file and extracting it to your project directory.

require: {
    "tinylara/tinyvalidator": "*"
}

Examples

$data = ['title'=>'', 'email'=>'1@baiducom'];
$rules = [
  'title' => 'required|min:3|max:255',
  'email' => 'required|email',
];

$validator = new \TinyLara\TinyValidator\TinyValidator($data, $rules);

if ( !$validator->success ) {
  foreach ($validator->errors as $error) {
    echo $error.'<br>';
  }
}

License

The TinyValidator is open-sourced software licensed under the MIT license.