PHP code example of jasperfw / validator

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

    

jasperfw / validator example snippets


$trim = new Trim() // This filter will trim the value before validating
$ast 5 characters
$errorMessage = null // This will be a string with the error message if validation fails. Optional.
$result = Alpha::quickValidate('bob', [$trim], [$

$$validationSet = new ValidationSet();
$validationSet->addValidator(newAlpha('username', InputSources::GET, [$ = $validationSet->isValid(); // Check the entire set.
$isUsernameValid = $validationSet->isFieldValid('username'); // Check if a single field is valid
$errors = $validationSet->getErrorMessages(); // Get all the errors as an array of strings
$value = $validationSet->getFieldValue('username'); // Get the value of a field, or null if the value was not valid