PHP code example of rajuthapa8086 / validator

1. Go to this page and download the library: Download rajuthapa8086/validator library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

rajuthapa8086 / validator example snippets




ajuThapa8086\Validator\Validator as Validator;

$validator = new Validator();

$rules = array(
	'username' => 'trim_word',
);


$inputs = array(
	'username' => 'as##ASAAS',
    'password' => 'aaa000a0a0s',
    'confirm_password' => 'asasas0as0d0as0d0as',
);

// OR
// $inputs => $_POST;


$errors = $validator->run($rules, $inputs);

// var_dump($errors);


 if (count($errors)):