PHP code example of phpauth / phpauth.email-validator
1. Go to this page and download the library: Download phpauth/phpauth.email-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/ */
phpauth / phpauth.email-validator example snippets
// ...
$config = new \PHPAuth\Config($pdo);
$config = $config->setEMailValidator(static function ($email) {
return \PHPAuth\EMailValidator::isValid($email);
});
$l = [
'[email protected]',
'[email protected]',
'xxxx'
];
foreach ($l as $e) {
var_dump(\PHPAuth\EMailValidator::check($e)->state);
echo "{$e} ==> " . ( \PHPAuth\EMailValidator::isValid($e) ? 'VALID' : 'INVALID' ) . PHP_EOL;
}