ekok/php-validation

v0.1.4 2022-04-14 04:31 UTC

This package is auto-updated.

Last update: 2024-11-14 09:59:19 UTC


README

PHP Validation.

Usage

<?php

use Ekok\Validation\Validator;

$validator = new Validator();
$data = array(
    'username' => 'foo',
    'password' => 'bar',
);
$rules = array(
    'username' => 'trim|min:5',
    'password' => 'trim|min:5',
);
// any validation error will throw Ekok\Validation\ValidationException
$result = $validator->validate($rules, $data);

// $result['username'] is ok
// $result['password'] is ok