PHP code example of lexuss1979 / validol

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

    

lexuss1979 / validol example snippets



use Lexuss1979\Validol\Validator;

$validation = Validator::process(['name' => 'Olga', 'age' => 18], [
    'name' => ';
} else {
    // There are errors
   var_dump($validation->errors());
}



use Lexuss1979\Validol\Validator;
$validation = Validator::process([], ['age' => ' 
$validation = Validator::process([ 'age' => 'seventeen' ], ['age' => 'sometimes integer']);
// fails because age must be an integer value if presents


use Lexuss1979\Validol\Validator;

$validation = Validator::process(['name' => 'Olga', 'age' => 18, 'email' => '[email protected]'], [
    'name' => '


use Lexuss1979\Validol\Validator;

$validation = Validator::process(['name' => 'Olga', 'age' => ''], [
    'address' => 'age' => ['age must be an integer value']]
 


use Lexuss1979\Validol\Validator;

$validation = Validator::process(['firstname' => 'Olga'], [
    'firstname as name' => '


use Lexuss1979\Validol\Validator;

$validation = Validator::process(['weight' => 'heavy'], [
    'weight' => ['