mirror of
https://github.com/egulias/EmailValidator.git
synced 2026-08-25 03:28:23 +00:00
0567c22d4af006ef10199503fbe5e2936a5ddd68
EmailValidator
#Installation# Install via composer.
#Usage#
Simple example:
<?php
use egulias\EmailValidator\EmailValidator;
$validator = new EmailValidator;
if ($validator->isValid($email)) {
echo $email . ' is a valid email address';
}
More advanced example (returns detailed diagnostic error codes):
<?php
use egulias\EmailValidator\EmailValidator;
$validator = new EmailValidator;
$email = 'dominic@sayers.cc';
$result = $validator->isValid($email);
if ($result) {
echo $email . ' is a valid email address';
} else if ($validator->hasWarnings()) {
echo 'Warning! ' . $email . ' has unusual/deprecated features (result code ' . var_export($validator->getWarnings(), true) . ')';
} else {
echo $email . ' is not a valid email address (result code ' . $validator->getError() . ')';
}
#Licence# Released under the MIT Licence attached with this code.
Languages
PHP
100%
