PHP code example of mkakpabla / validation

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

    

mkakpabla / validation example snippets




en\Validation\Validator;

$validator = new Validator([], [
  'title' => 'validate();

if(!$validator->isValid()) {
  var_dump($validator->errors());
} else {
  
  // Formulaire valide
  // Traitements
}



en\Validation\Validator;
$validator = new Validator($data, [
  'title'  => 'ire"
]);
$validator->validate();