PHP Classes

Easy Input Validator: Validate request values according to given rules

Recommend this page to a friend!
  Info   View files Example   View files View files (11)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 157 All time: 8,999 This week: 455Up
Version License PHP version Categories
easy-input-validator 1.0.0MIT/X Consortium ...5.4PHP 5, Validation


This package can validate request values according to given rules.

It can take a given array of request values eventually from $_GET or $_POST and it validate the values according to given rules of another given array.

It validates the values using separate validation rules classes.

Currently it provides rules class for validating values as email, entity exists, field is the same as other, maximum length, may not exists, minimum length, required, and unique entity.

Picture of Aleksandar Zivanovic
  Performance   Level  
Name: Aleksandar Zivanovic <contact>
Classes: 16 packages by
Country: Serbia Serbia
Age: 30
All time rank: 16206 in Serbia Serbia
Week rank: 307 Up2 in Serbia Serbia Up
Innovation award
Innovation award
Nominee: 4x



 * List of available rules:
 * min (int value) -> Checks for minimum input value
 * max (int value) -> Checks for maximum input value
 * unique (string table, string column) -> Check for column with value in table valid if not found
 * same (string field) -> Compares current and given field values
 * required -> Checks for field existance and true value
 * exists (string table, string column) -> Same as UNIQUE but its valid if it is found
 * may-not-exists -> Its valid if field is not present
 * email -> Validates mail
 * Usage:
 * rule:param1,param2|rule2|rule3:param.......

use InputValidator\InputValidator;

$files = scandir(__DIR__ . '/Rules');

foreach (
$files as $file) {
    if (
0 === strpos($file, '.')) {

__DIR__ . "/Rules/{$file}";

__DIR__ . '/InputValidator.php';

$input = filter_input_array(INPUT_GET) ?: [];

$validator = new InputValidator($input);

$rules = [
'username' => 'required|min:3|max:24',
'first-name' => 'max:12',
'last-name' => 'max:12',
'email' => 'required|email',
'password' => 'required|min:6',
're-password' => 'same:password'

$valid = $validator->validate($rules);

var_dump($valid, $validator->getErrors());

  Files folder image Files  
File Role Description
Files folder imageRules (9 files)
Accessible without login Plain text file example.php Example Example script
Plain text file InputValidator.php Class Class file

  Files folder image Files  /  Rules  
File Role Description
  Plain text file InputValidatorRule.php Class Input Validator Rule Abstract
  Plain text file RuleEmail.php Class Rule for validating email
  Plain text file RuleEntityExists.php Class Rule for validating existance of database record
  Plain text file RuleFieldSameAsOther.php Class Rule for validating fields value that is same as another field value
  Plain text file RuleMaximumLength.php Class Rule for validating maximum length of value
  Plain text file RuleMayNotExists.php Class Rule for validating that entity in database does not exists
  Plain text file RuleMinimumLength.php Class Rule for validating minimum length of value
  Plain text file RuleRequired.php Class Rule for validating existance of input
  Plain text file RuleUniqueEntity.php Class Rule for checking uniquenes of record in database (simillar to "same")

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:8,999
This week:455Up