PHP code example of district5 / validators
1. Go to this page and download the library: Download district5/validators 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/ */
district5 / validators example snippets
$validValue = true;
$invalidValue = 'Hello';
$validator = new \District5\Validators\BoolValue();
$validator->isValid($validValue); // true
$validator->isValid($invalidValue); // false
// Simple format check:
$validator = new \District5\Validators\EmailAddress();
$validator->isValid('[email protected]'); // true
// Deeper check, which nthatdoesntexist.com'); // false