PHP code example of psecio / validation

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

    

psecio / validation example snippets




$v = \Psecio\Validate\Validator::getInstance();

$data = [
    'foo' => 'bar'
];
$rules = [
    'foo' => '


$v = \Psecio\Validate\Validator::getInstance();
$data = [
    'foo' => 'bar'
];
$rules = [
    'foo' => 'essages);
var_export($result);

// Minimum of 1, max of 10
$rules = ['mynumber' => 'integer[1,10]'];

// Using just the minimum, checking for a length of at least 3
$rules = ['mystring' => 'length[3]']

// Using both minimum and maximum, check for a length between 3 and 10
$rules = ['mystring' => 'length[3,10]']

// Check to see if the date provided is before yesterday
$rules = [
    'myinputdate' => 'before[yesterday]'
];

// Check to see if the date is in the last three days
$rules = [
    'myinputdate' => 'after[-3 days]'
];

// Check to see if the value is one of "foo", "bar" or "baz"
$rules = [
    'myvalue' => 'in[foo,bar,baz]'
]

$rules = [
    'mystring' => 'regex[/[0-9a-z]+/]'
]


class Foo {
	public static function check($input) { ... }
}

$rules = [
	'mystring' => 'callback[Foo::check]'
];