PHP code example of ggbear / validation

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

    

ggbear / validation example snippets



/** @var Factory $validatorFactory */
$validatorFactory = new ValidatorFactory();

$number = '123456789012a';
$id = 123;
$string = 'string value';
$channel = 'UNKNOWN';

$input = [
    'number' => $number,
    'id' => $id,
    'string' => $string,
    'channel' => $channel
];
$rules = [
    'number' => '

if ($validator->fails()) {
    print_r($validator->errors()->toArray());
} else {
    echo 'Validaton passed.' . PHP_EOL;
}