PHP code example of fyre / validation

1. Go to this page and download the library: Download fyre/validation 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/ */

    

fyre / validation example snippets


use Fyre\Validation\Rule;
use Fyre\Validation\Validator;

$validator = new Validator();

$validator->add($field, $rule, $options);

$validator->clear();

$rules = $validator->getFieldRules($field);

$removed = $validator->remove($field, $name);

$validator->remove($field);

$errors = $validator->validate($data, $type);

Rule::alpha();

Rule::alphaNumeric();

Rule::ascii();

Rule::between($min, $max);

Rule::boolean();

Rule::decimal();

Rule::date();

Rule::dateTime();

Rule::differs($field);

Rule::email();

Rule::empty();

Rule::equals($value);

Rule::exactLength($length);

Rule::greaterThan($min);

Rule::greaterThanOrEquals($min);

Rule::in($values);

Rule::integer();

Rule::ip();

Rule::ipv4();

Rule::ipv6();

Rule::lessThan($max);

Rule::lessThanOrEquals($max);

Rule::matches($field);

Rule::maxLength($length);

Rule::minLength($length);

Rule::naturalNumber();

Rule::notEmpty();

Rule::regex($regex);

Rule::

Rule::

Rule::time();

Rule::url();

$validator->add('field', Rule::

$validator->add('field', function($value) {
    if ($value) {
        return true;
    }

    return 'The field is 

// language/en/Validation.php

return [
    '