Home

Awesome

Email Validator

Small PHP library to valid email addresses using a number of methods.

License Build Status Code Quality Downloads Github Stars

Features

Install (using Composer)

composer require nojacko/email-validator:~1.0

Usage

Generalised Functions

Specific Functions

If you want more control, use these functions seperately.

These functions take a single argument (an email address) and return:

Examples

$validator = new \EmailValidator\Validator();

$validator->isValid('example@google.com');              // true
$validator->isValid('abuse@google.com');                // false
$validator->isValid('example@example.com');             // false

$validator->isSendable('example@google.com');           // true
$validator->isSendable('abuse@google.com');             // true
$validator->isSendable('example@example.com');          // false

$validator->isEmail('example@example.com');             // true
$validator->isEmail('example@example');                 // false

$validator->isExample('example@example.com');           // true
$validator->isExample('example@google.com');            // false
$validator->isExample('example.com');                   // null

$validator->isDisposable('example@example.com');        // false
$validator->isDisposable('example@mailinater.com');     // true
$validator->isDisposable('example.com');                // null

$validator->isRole('example@example.com');              // false
$validator->isRole('abuse@example.com');                // true
$validator->isRole('example.com');                      // null

$validator->hasMx('example@example.com');               // false
$validator->hasMx('example@google.com');                // true
$validator->hasMx('example.com');                       // null

Contribute

Contributions welcome!

Requirements

Add/Remove Disposable Domain

See the email-data-disposable project.

New Feature

If you're planning a new feature, please raise an issue first to ensure it's in scope. The aim is to keep this library small and with one specific purpose.

Other Contributions

For anything that isn't a new feature (bug fix, tests, etc) just create a pull request.

Testing

Test are all located in tests folder.

Run tests with phpunit. In root folder, execute phpunit in a CLI.

Versioning

Semantic Versioning 2.0.0

License

The MIT License (MIT). See LICENCE file.