PHP Classes

Quest PHP Validation Library: Validate values with general and custom rules

Recommend this page to a friend!

  Author Author  
Picture of Edward Paul
Name: Edward Paul <contact>
Classes: 16 packages by
Country: Nigeria Nigeria
Innovation award
Innovation award
Nominee: 9x

Winner: 1x


  Detailed description   Download Download .zip .tar.gz   Install with Composer Install with Composer  
This package can validate values with general and custom rules.

It can take an array of values as a parameter and validate it with a set of rules.

The package supports several types of built-in and custom rules using external classes specified by the applications to implement custom validation logic.

The validation function returns whether all validation rules passed and an array with the list of parameter values that do not give the validation rules.

Currently, it provides classes that implement rules like:

- Blacklisted domains

- Email address

- Minimum number

- Maximum number

- Password

- Required

- Number sequence

Details

Tech Stack

  • PHP
  • Composer

Download Instruction

  1. Clone the project.
git clone https://github.com/infinitypaul/quest.git projectname

  1. Install dependencies via composer.
composer install 

  1. Run php server.
php -S localhost:8000

  1. Sample Response

img.png

  1. Sample Code
$check = new \App\Checkers\Check([
    'name' => '',
    'email' => [
        'infinitypaul@live.com',
        '',
        'ade',
        'ade@google.com'
    ],
    'password' => 'eeee'
]);

$check->setRules([
    'name' => [
        'required'
    ],
    'email.*' => [
        new \App\Checkers\Rules\Required(),
        'email',
        'blacklist'
    ],
    'password' => [
        'min:5',
        'sequence'
    ]
]);


if(!$check->validate()){
    dump($check->getErrors());
} else {
    dump("passed");
};

You can either define your rules as a class

new \App\Checkers\Rules\Required(),

or as a string

required

you can also define your own rule by extending the Rule Class

class EmailRule extends Rule
{

    /
     * @param $field
     * @param $value
     * @return bool
     */
    public function passes($field, $value): bool
    {
        return filter_var($value, FILTER_VALIDATE_EMAIL);
    }

    /
     * @param $field
     * @return string
     */
    public function message($field): string
    {
        return ucwords($field. ' Must Be A Valid Email Address');
    }
}

If you prefer it to br string base, you can define it in the RuleMap.php

'email' => EmailRule::class

Organization Password Policy

The service is very flexible, and new rules can be added without much code.

What is needed is to create a new rule, extend the RULE class, and define all your conditions and organization password policy like the one below

  • Password/Passphrase Length Policy
  • Password Deny List
  • Password Combination
  • Password Checks to be sure it isn't part of the leaked password

  Classes of Edward Paul  >  Quest PHP Validation Library  >  Download Download .zip .tar.gz  >  Support forum Support forum  >  Blog Blog  >  RSS 1.0 feed RSS 2.0 feed Latest changes  
Name: Quest PHP Validation Library
Base name: quest
Description: Validate values with general and custom rules
Version: 1.0.0
PHP version: 5
License: The PHP License
 
  Groups   Screenshots Screenshots   Applications   Files Files  

  Groups  
Group folder image PHP 5 Classes using PHP 5 specific features View top rated classes
Group folder image Validation Validation algorithms View top rated classes

  Files folder image Screenshots  
img.png
File Role Description
Accessible without login Image file img.png Screen Screenshot


  Applications that use this package  
No pages of applications that use this class were specified.

Add link image If you know an application of this package, send a message to the author to add a link here.

  Files folder image Files  
File Role Description
Files folder imageapp (1 directory)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file composer.lock Data Auxiliary data
Accessible without login Plain text file index.php Example Example script
Accessible without login Plain text file readMe.md Doc. Documentation

  Files folder image Files  /  app  
File Role Description
Files folder imageCheckers (2 files, 2 directories)

  Files folder image Files  /  app  /  Checkers  
File Role Description
Files folder imageErrors (1 file)
Files folder imageRules (7 files)
  Plain text file Check.php Class Class source
  Plain text file RuleMap.php Class Class source

  Files folder image Files  /  app  /  Checkers  /  Errors  
File Role Description
  Plain text file Errors.php Class Class source

  Files folder image Files  /  app  /  Checkers  /  Rules  
File Role Description
  Plain text file DomainBlackListRule.php Class Class source
  Plain text file EmailRule.php Class Class source
  Plain text file MinRule.php Class Class source
  Plain text file PasswordRule.php Class Class source
  Plain text file Required.php Class Class source
  Plain text file Rule.php Class Class source
  Plain text file Sequence.php Class Class source

Install with Composer Install with Composer - Download Download all files: quest.tar.gz quest.zip
NOTICE: if you are using a download manager program like 'GetRight', please Login before trying to download this archive.
  Files folder image Files  
File Role Description
Files folder imageapp (1 directory)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file composer.lock Data Auxiliary data
Accessible without login Plain text file index.php Example Example script
Accessible without login Plain text file readMe.md Doc. Documentation

  Files folder image Files  /  app  
File Role Description
Files folder imageCheckers (2 files, 2 directories)

  Files folder image Files  /  app  /  Checkers  
File Role Description
Files folder imageErrors (1 file)
Files folder imageRules (7 files)
  Plain text file Check.php Class Class source
  Plain text file RuleMap.php Class Class source

  Files folder image Files  /  app  /  Checkers  /  Errors  
File Role Description
  Plain text file Errors.php Class Class source

  Files folder image Files  /  app  /  Checkers  /  Rules  
File Role Description
  Plain text file DomainBlackListRule.php Class Class source
  Plain text file EmailRule.php Class Class source
  Plain text file MinRule.php Class Class source
  Plain text file PasswordRule.php Class Class source
  Plain text file Required.php Class Class source
  Plain text file Rule.php Class Class source
  Plain text file Sequence.php Class Class source

Install with Composer Install with Composer - Download Download all files: quest.tar.gz quest.zip
NOTICE: if you are using a download manager program like 'GetRight', please Login before trying to download this archive.