PHPackages                             auvernhat/easyemailvalidator - 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. auvernhat/easyemailvalidator

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

auvernhat/easyemailvalidator
============================

A lightweight PHP package to validate email addresses against allowed and denied domain lists.

1.1.0(5mo ago)213MITPHPCI passing

Since Aug 11Pushed 5mo agoCompare

[ Source](https://github.com/auvernhatinternet/EasyEmailValidator)[ Packagist](https://packagist.org/packages/auvernhat/easyemailvalidator)[ RSS](/packages/auvernhat-easyemailvalidator/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (5)Dependencies (3)Versions (6)Used By (0)

EasyEmailValidator
==================

[](#easyemailvalidator)

A lightweight PHP package to validate email addresses against allowed and denied domain lists.

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

[](#installation)

Add the package to your project with Composer:

```
composer require auvernhat/easyemailvalidator
```

Usage
-----

[](#usage)

```
use Auvernhat\EasyEmailValidator\EasyValidator;

$validator = new EasyValidator();

// Validate a single email address
$isValid = $validator->validate('test@gmail.com'); // true or false

// Validate multiple email addresses
$allValid = $validator->validateMultiple([
    'test@gmail.com',
    'test@outlook.com'
]); // true if all are valid, false otherwise
```

Providers
---------

[](#providers)

EasyEmailValidator supports multiple providers to fetch lists of allowed or denied email domains.
A **provider** is a PHP class that extends the abstract class `ProviderAbstract` and implements two methods:

- `getAllowDomains(): array` — returns an array of allowed domains (can be empty if not used).
- `getDenyDomains(): array` — returns an array of denied domains.

### Available Providers

[](#available-providers)

Several providers are included by default:

- **AmieiroProvider**
    Uses the public lists from [amieiro/disposable-email-domains](https://github.com/amieiro/disposable-email-domains).
- **AdamLovingProvider**
    Uses the list from [Adam Loving's gist](https://gist.github.com/adamloving/4401361).
- **DisposableProvider**
    Uses the list from [disposable/disposable-email-domains](https://github.com/disposable/disposable-email-domains).

### How to Use a Provider

[](#how-to-use-a-provider)

You can specify the provider to use when creating the validator:

```
use Auvernhat\EasyEmailValidator\EasyValidator;
use Auvernhat\EasyEmailValidator\Providers\AdamLovingProvider;

$validator = new EasyValidator(new AdamLovingProvider());
$isValid = $validator->validate('test@gmail.com');
```

If you don't specify a provider, the default is `DisposableProvider`:

```
$validator = new EasyValidator(); // Uses DisposableProvider by default
```

### How to Create Your Own Provider

[](#how-to-create-your-own-provider)

To add your own provider, create a new class in `src/Providers/` that extends `ProviderAbstract` and implements the required methods:

```
use Auvernhat\EasyEmailValidator\Providers\ProviderAbstract;

class MyCustomProvider extends ProviderAbstract
{
    public function getAllowDomains(): array
    {
        // Return your list of allowed domains
        return ['example.com'];
        // Return nothing if you only want a deny list
        return [];
    }

    public function getDenyDomains(): array
    {
        // Return your list of denied domains
        return ['tempmail.com', 'mailinator.com'];
        // Return nothing if you only want an allow list
        return [];
    }
}
```

Example: Allow Only Your Company's Emails
-----------------------------------------

[](#example-allow-only-your-companys-emails)

You can create a custom provider that only allows emails from your own company domain. For example, to only accept `@mycompany.com` addresses:

```
use Auvernhat\EasyEmailValidator\Providers\ProviderAbstract;

class MyCustomProvider extends ProviderAbstract
{
    public function getAllowDomains(): array
    {
        return ['mycompany.com'];
    }

    public function getDenyDomains(): array
    {
        return [];
    }
}

$validator = new EasyValidator(new MyCustomProvider);

$res = $validator->validate("test@gmail.com");
// returns false
$res = $validator->validate("test@mycompany.com");
// returns true
```

This is useful if you want to restrict access or registration to your own organization only.

Simple, fast, and effective for filtering disposable emails!

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance70

Regular maintenance activity

Popularity8

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity40

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 ~25 days

Total

5

Last Release

178d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e2acb927ea6a247ccf0be4f2b2cd17704a31502f88c210587546b17235fc4e92?d=identicon)[rrr63](/maintainers/rrr63)

---

Top Contributors

[![rrr63](https://avatars.githubusercontent.com/u/46089601?v=4)](https://github.com/rrr63 "rrr63 (10 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/auvernhat-easyemailvalidator/health.svg)

```
[![Health](https://phpackages.com/badges/auvernhat-easyemailvalidator/health.svg)](https://phpackages.com/packages/auvernhat-easyemailvalidator)
```

###  Alternatives

[webmozart/assert

Assertions to validate method input/output with nice error messages.

7.6k894.0M1.2k](/packages/webmozart-assert)[bensampo/laravel-enum

Simple, extensible and powerful enumeration implementation for Laravel.

2.0k15.9M104](/packages/bensampo-laravel-enum)[swaggest/json-schema

High definition PHP structures with JSON-schema based validation

48612.5M73](/packages/swaggest-json-schema)[stevebauman/purify

An HTML Purifier / Sanitizer for Laravel

5325.6M19](/packages/stevebauman-purify)[ashallendesign/laravel-config-validator

A package for validating your Laravel app's config.

217905.3k5](/packages/ashallendesign-laravel-config-validator)[crazybooot/base64-validation

Laravel validators for base64 encoded files

1341.9M8](/packages/crazybooot-base64-validation)

PHPackages © 2026

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