PHP code example of mrjulio / rapture-validation
1. Go to this page and download the library: Download mrjulio/rapture-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/ */
mrjulio / rapture-validation example snippets
$validator = new Email();
$validator->isValid('[email protected]'); // true
$validator->isValid('test[at]gmail.com'); // false
$validator = new Country(Country::ISO2);
$validator->isValid('us'); // true
$validator->isValid('ux'); // false
// Group Validator
$validator = new Group([
'email' => [
['lue"'],
]
]);
$validator->isValid([
'email' => '[email protected]',
'age' => 1,
'country' => 'xxx'
]); // false
$validator->getFirstError(); // Invalid ISO3 for country "xxx"