PHPackages                             enricodias/email-validator - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Validation &amp; Sanitization](/categories/validation)
4. /
5. enricodias/email-validator

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

enricodias/email-validator
==========================

Validate and check for disposable/temporary/throw away emails using multiple providers

v0.9(9mo ago)66871[1 issues](https://github.com/enricodias/emailValidator/issues)MITPHPPHP &gt;=5.6CI failing

Since Oct 20Pushed 9mo ago1 watchersCompare

[ Source](https://github.com/enricodias/emailValidator)[ Packagist](https://packagist.org/packages/enricodias/email-validator)[ RSS](/packages/enricodias-email-validator/feed)WikiDiscussions master Synced today

READMEChangelog (10)Dependencies (3)Versions (13)Used By (0)

emailValidator
==============

[](#emailvalidator)

[![Build Status](https://camo.githubusercontent.com/e34dbd57894c989006ce6009b5cc29065519129088d1266801916300890adca2/68747470733a2f2f696d672e736869656c64732e696f2f636972636c6563692f6275696c642f6769746875622f656e7269636f646961732f656d61696c56616c696461746f722f6d6173746572)](https://circleci.com/gh/enricodias/emailValidator/tree/master)[![Codacy Badge](https://camo.githubusercontent.com/41392ecad75a74e51327c6864d845a873463bf41c88877c10cf4db2fbee4755f/68747470733a2f2f6170702e636f646163792e636f6d2f70726f6a6563742f62616467652f47726164652f3132356433346462386130343433653062343333636263646534373836333732)](https://app.codacy.com/gh/enricodias/emailValidator/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)[![Codacy Badge](https://camo.githubusercontent.com/f5e77056fcba7935cea807e9e02703d07201a27c8a11e321a48bd69a97247360/68747470733a2f2f6170702e636f646163792e636f6d2f70726f6a6563742f62616467652f436f7665726167652f3132356433346462386130343433653062343333636263646534373836333732)](https://app.codacy.com/gh/enricodias/emailValidator/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_coverage)[![Latest version](https://camo.githubusercontent.com/5b0197db2a7ecd9fad77928e760253bd8acfba7681a72353d2b964c6b078b9d5/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f656e7269636f646961732f656d61696c2d76616c696461746f722e737667)](https://packagist.org/packages/enricodias/email-validator)[![Downloads total](https://camo.githubusercontent.com/a959aaa8fc1dfc3ba8ee5ef6b4f7b24c7212a00866774167971dea01a7885749/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f656e7269636f646961732f656d61696c2d76616c696461746f722e737667)](https://packagist.org/packages/enricodias/email-validator)[![License](https://camo.githubusercontent.com/f9b4d590171d3dd5f1a12035180875a2fbd7ec4ecce1547d3f19221f74191a2c/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f656e7269636f646961732f656d61696c2d76616c696461746f722e737667)](https://github.com/enricodias/email-validator/blob/master/LICENSE.md)

Validate and check for disposable/temporary/throw away emails.

Installation
------------

[](#installation)

Require this package with Composer in the root directory of your project.

```
composer require enricodias/email-validator
```

Basic Usage
-----------

[](#basic-usage)

```
$emailValidator = new \enricodias\EmailValidator\EmailValidator();
$emailValidator->validate('test+mail@gmail.co');

$emailValidator->isValid();      // false, gmail.co doesn't have valid MX entries
$emailValidator->isDisposable(); // false, gmail.co isn't a known domain for disposable emails
$emailValidator->isAlias();      // true, test+mail@gmail.co is alias for test@gmail.co
$emailValidator->didYouMean();   // test+mail@gmail.com
```

Service Providers
-----------------

[](#service-providers)

A service provider is a third party service that validates the email, usually using an API. You may register several providers to be used on the validation.

The registered providers will be used in sequence until one of them returns a valid response. This is especially useful if you want a provider to act as a failover.

UserCheck is enabled by default.

```
$MailboxLayer = new \enricodias\EmailValidator\ServiceProviders\MailboxLayer('API_KEY');

$Mailgun = new \enricodias\EmailValidator\ServiceProviders\Mailgun('API_KEY');

$emailValidator->addProvider($MailboxLayer, 'MailboxLayer');
$emailValidator->addProvider($Mailgun); // the name is optional

$emailValidator->validate('test@email.com');
```

### Implemented providers

[](#implemented-providers)

ProviderFree TierCost per validationUnsupported Features[UserCheck](https://www.usercheck.com/)1000 verifications per month$0.00014 to $0.00025`isHighRisk()`[MailboxLayer](https://mailboxLayer.com/)250 verifications per month$0.002 to $0.0006[NeverBounce](https://neverbounce.com/)1000 verifications$0.008 to $0.003`isHighRisk()`[Kickbox](https://kickbox.com/)100 verifications$0.010 to $0.004[Mailgun](https://mailgun.com/)0$0.012 to $0.0025`didYouMean()`\*\*\* MailCheck.ai and Validator.pizza is now called UserCheck \*\* the feature is documented but as for now, the API never returns a suggestion.

### Custom providers

[](#custom-providers)

You can add a custom provider by implementing the class `ServiceProviderInterface`. It's possible to remove the default UserCheck provider using `removeProvider()` method or remove all all providers using `clearProviders()` method:

```
$emailValidator = new \enricodias\EmailValidator\EmailValidator();

$emailValidator->clearProviders(); // remove all providers

$emailValidator->addProvider($CustomServiceProvider, 'My Custom Provider');

$emailValidator->validate('test@email.com');
```

You can use the static method `create()` to create an instance and chain methods:

```
$emailValidator = \enricodias\EmailValidator\EmailValidator::create()
    ->removeProvider('UserCheck');
    ->addProvider($CustomServiceProvider)
    ->validate('test@email.com');
```

Note that providers registered without a name cannot be removed by `removeProvider()`.

### Shuffle providers

[](#shuffle-providers)

Shuffling the service providers list is useful when using the free tier of multiple providers. Without shuffling, the providers will always be used in the same order resulting in unnecessary failures when the first provider runs out of credits.

```
$emailValidator->clearProviders()
    ->addProvider($Provider1)
    ->addProvider($Provider2)
    ->shuffleProviders()
    ->validate('test@email.com');
```

How it works
------------

[](#how-it-works)

The class checks locally if the email syntax is valid and if so, it calls a service provider.

### Rate limit

[](#rate-limit)

Since most service providers are either paid or have a limit of requests per hour per ip, no request is made if the email doesn't pass on the local validation checks.

### Local domain list

[](#local-domain-list)

To lower the number of API requests the local checks include a list with the most common disposable domains. This list is intended to be short in order to not affect performance and avoid the need of constants updates. Wildcards `*` are allowed.

### Additional Domains

[](#additional-domains)

It's likely that the most popular disposable email services among your users are not on the default list, so you may want to customize the list using the `addDomains()` method:

```
$emailValidator = \enricodias\EmailValidator\EmailValidator::create()
    ->addDomains(['*.domain.com'])
    ->validate('test@sub.domain.com',);

$emailValidator->isDisposable(); // true
```

This method doesn't accepts a string, only an array.

Validation methods
------------------

[](#validation-methods)

### isValid()

[](#isvalid)

Returns `true` if the email is valid.

The email is considered invalid if it fails on the local syntax check OR if it fails in the service provider's check. Note that disposable emails are valid emails.

### isDisposable()

[](#isdisposable)

Returns `true` if the email is a disposable email.

### isAlias()

[](#isalias)

Returns `true` if the email is an alias. Example: `test+mail@gmail.com` is an alias of `test@gmail.com`.

### didYouMean()

[](#didyoumean)

If the email has a simple and obvious typo such as `gmail.cm` instead of `gmail.com` this method will return a string with a suggested correction, otherwise it will return an empty string.

It's recommended to use this feature using `javascript` in the client side with an option for them to correct the email before submitting the form

### isHighRisk()

[](#ishighrisk)

Most service providers have a risk analysis tool. This method returns `true` if the risk is high.

###  Health Score

36

—

LowBetter than 81% of packages

Maintenance54

Moderate activity, may be stable

Popularity21

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~192 days

Recently: every ~526 days

Total

12

Last Release

274d ago

PHP version history (2 changes)v0.1PHP &gt;=5.3.3

v0.2PHP &gt;=5.6

### Community

Maintainers

![](https://www.gravatar.com/avatar/7d69ec6f15869c0c5c5f1faabf873e4b05b1082dce513f5342904faea25f2500?d=identicon)[enricodias](/maintainers/enricodias)

---

Top Contributors

[![enricodias](https://avatars.githubusercontent.com/u/32619307?v=4)](https://github.com/enricodias "enricodias (186 commits)")

---

Tags

emaildisposabletemporary emailemail validatorthrow away email

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/enricodias-email-validator/health.svg)

```
[![Health](https://phpackages.com/badges/enricodias-email-validator/health.svg)](https://phpackages.com/packages/enricodias-email-validator)
```

###  Alternatives

[erag/laravel-disposable-email

A Laravel package to detect and block disposable email addresses.

226102.4k](/packages/erag-laravel-disposable-email)[aporat/store-receipt-validator

PHP receipt validator for Apple App Store and Amazon Appstore

6503.9M9](/packages/aporat-store-receipt-validator)[fgribreau/mailchecker

Temporary (disposable/throwaway) email detection library. Covers 1987 fake email providers.

1.9k662.6k4](/packages/fgribreau-mailchecker)[propaganistas/laravel-disposable-email

Disposable email validator

5762.6M6](/packages/propaganistas-laravel-disposable-email)[mattketmo/email-checker

Throwaway email detection library

2742.0M5](/packages/mattketmo-email-checker)[robertogallea/laravel-codicefiscale

Codice fiscale validation for php/laravel

58151.6k1](/packages/robertogallea-laravel-codicefiscale)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
