mirror of
https://github.com/egulias/EmailValidator.git
synced 2026-08-18 06:50:28 +00:00
9c360e0ef735db2b28b6ee6b0de401f4a4bf3ed8
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%
