shoyim/php-validation

php requests validation helper functions

dev-main 2024-09-16 11:02 UTC

This package is auto-updated.

Last update: 2024-11-16 11:19:29 UTC


README

A php package for validation.

Installation

Install via composer

composer require shoyim/php-validation

Usage

require 'vendor/autoload.php';

use Shoyim\PhpValidation\Validator;

$params = [
    'username' => 'shoyimobloqulov',
    'email' => 'admin@gmail.com',
    'password' => '123'
];

$validateRules = [
    'email' => 'required|email',
    'username' => 'required|string|min:5|max:10',
    'password' => 'required|password'
];

$validator = new Validator();
$validator->validate($validateRules, $params);

var_dump($validator->fails());
var_dump($validator->getErrors());