phpauth / phpauth.email-validator
PHPAuth E-Mail Validator
0.1.1
2022-08-23 14:53 UTC
Requires
- php: >=7.2.0
- ext-json: *
Requires (Dev)
- phpunit/phpunit: 6.*
This package is not auto-updated.
Last update: 2024-11-13 23:49:12 UTC
README
Custom e-mail validator (for PHPAuth)
Use with PHPAuth
require_once __DIR__ . '/path/to/vendor/autoload.php'; // ... $config = new \PHPAuth\Config($pdo); $config = $config->setEMailValidator(static function ($email) { return \PHPAuth\EMailValidator::isValid($email); });
Standalone usage:
require_once __DIR__ . '/path/to/vendor/autoload.php'; $l = [ 'karel.wintersky@gmail.com', 'foo@0d00.com', 'xxxx' ]; foreach ($l as $e) { var_dump(\PHPAuth\EMailValidator::check($e)->state); echo "{$e} ==> " . ( \PHPAuth\EMailValidator::isValid($e) ? 'VALID' : 'INVALID' ) . PHP_EOL; }
FAQ
Q: Why static class? A: Email validator uses internal cache for storing loaded domains. It can be useful for sequential checks.
Thanks to
- https://github.com/MattKetmo/EmailChecker
- https://github.com/FGRibreau/mailchecker
- legacy PHPAuth
domains.json
and legacydatabase_emails_banned.sql