Skip to content

atakde/php-validation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

php-validation

A php package for validation.

Installation

Install via composer

composer require atakde/php-validation

Usage

require 'vendor/autoload.php';

use Atakde\PhpValidation\Validator;

$params = [
    'username' => 'TestUsername',
    'email' => '[email protected]',
    '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());