PHP code example of lefuturiste / validator

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

    

lefuturiste / validator example snippets


$validator = new Validator($request->getParsedBody());

$validator = new Validator($_POST);

$validator->>notEmpty('example');

$validator->isValid(); // TRUE|FALSE

$validator->getErrors();

$validator->getErrors(\Validator\ValidationError::FORMAT_WITH_KEYS);

$validator->getErrors(\Validator\ValidationError::FORMAT_ARRAY);

\Validator\ValidationError::setDefaultFormat(\Validator\ValidationError::FORMAT_ARRAY);

ValidationLanguage::setLang('fr'); // or `en` or `es`