PHP Classes

PHP Validation: Validate request values according to given rules

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 126 All time: 9,431 This week: 660Up
Version License PHP version Categories
php-validation 1.0.0MIT/X Consortium ...5PHP 5, Validation
Description 

Author

This package can validate request values according to given rules.

It can take as parameters an array with request values and an array of rules to apply to the values to be validated.

The package can validate the values and can return a list of errors in case at least of the values is invalid.

Picture of Muhammad Umer Farooq
Name: Muhammad Umer Farooq <contact>
Classes: 52 packages by
Country: Pakistan Pakistan
Innovation award
Innovation award
Nominee: 6x

Example

<?php

   
require __DIR__.'/vendor/autoload.php';
   
   
$rules = [
       
'username' => ['required' => true, ],
       
'email' => ['required' => true],
       
'password' => ['required' => true, ],
    ];
   
$validation = new Validation($_POST,$rules,'input');
    if(
$validation->fail()){
       
$errors = $validation->error()->get();

        foreach (
$errors as $error) {
            foreach (
$error as $value) {
                echo
$value."<br>";
            }
        }
    } else {
       
//TO-Do create the user
   
}


  Files folder image Files (9)  
File Role Description
Files folder imageexample (1 file)
Files folder imagesrc (5 files)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file readme.md Doc. Read me

  Files folder image Files (9)  /  example  
File Role Description
  Accessible without login Plain text file index.php Example Example script

  Files folder image Files (9)  /  src  
File Role Description
  Plain text file Handler.php Class Class source
  Plain text file InputRules.php Class Class source
  Plain text file JsonRules.php Class Class source
  Plain text file StickyRules.php Class Class source
  Plain text file Validation.php Class Class source

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:126
This week:0
All time:9,431
This week:660Up