PHPackages                             arraypress/email-blocklist - 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. arraypress/email-blocklist

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

arraypress/email-blocklist
==========================

A simple, efficient library for checking email addresses against disposable email provider lists.

021[1 PRs](https://github.com/arraypress/email-blocklist/pulls)PHPCI passing

Since Apr 5Pushed 1mo agoCompare

[ Source](https://github.com/arraypress/email-blocklist)[ Packagist](https://packagist.org/packages/arraypress/email-blocklist)[ RSS](/packages/arraypress-email-blocklist/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Email Blocklist
===============

[](#email-blocklist)

A simple, efficient library for checking email addresses against disposable email provider lists. Uses data from the [disposable-email-domains](https://github.com/disposable-email-domains/disposable-email-domains) project.

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

[](#installation)

```
composer require arraypress/email-blocklist
```

Usage
-----

[](#usage)

### Quick Check

[](#quick-check)

```
// Using the helper function
if ( is_disposable_email( 'user@tempmail.com' ) ) {
    // Reject registration
}
```

### Using the Class

[](#using-the-class)

```
use ArrayPress\EmailBlocklist\Blocklist;

$blocklist = new Blocklist();

// Check if disposable
$blocklist->is_disposable( 'user@tempmail.com' );     // true
$blocklist->is_disposable( 'user@gmail.com' );        // false

// Check if blocked (includes custom blocked domains)
$blocklist->is_blocked( 'user@tempmail.com' );        // true

// Check if explicitly allowed
$blocklist->is_allowed( 'user@company.com' );         // false
```

### Custom Blocked/Allowed Domains

[](#custom-blockedallowed-domains)

```
// Via constructor
$blocklist = new Blocklist(
    blocked: ['competitor.com', 'banned.org'],
    allowed: ['partner.com', 'trusted.org']
);

// Or fluent methods
$blocklist = new Blocklist();
$blocklist->block( ['competitor.com', 'banned.org'] );
$blocklist->allow( ['partner.com', 'trusted.org'] );

// Single domain
$blocklist->block( 'spammer.com' );
$blocklist->allow( 'friend.com' );

// Remove from custom lists
$blocklist->unblock( 'competitor.com' );
$blocklist->disallow( 'partner.com' );

// Clear all custom entries
$blocklist->clear();
```

### With Email Objects

[](#with-email-objects)

Works with any object that has a `domain()` method:

```
use ArrayPress\EmailUtils\Email;
use ArrayPress\EmailBlocklist\Blocklist;

$email = Email::parse( 'user@tempmail.com' );
$blocklist = new Blocklist();

if ( $email && $blocklist->is_disposable( $email ) ) {
    // Reject
}
```

### Custom Data Path

[](#custom-data-path)

```
// Use a custom directory for data files
$blocklist = new Blocklist(
    data_path: '/path/to/your/data'
);
```

How It Works
------------

[](#how-it-works)

The library uses array flipping for O(1) lookups:

```
// Instead of O(n) search through 170k domains
in_array( $domain, $huge_list );  // Slow

// We use O(1) hash lookup
isset( $flipped_list[ $domain ] );  // Instant
```

Subdomain matching is supported — if `tempmail.com` is blocked, `sub.tempmail.com` is also blocked.

Priority Order
--------------

[](#priority-order)

When checking an email:

1. **Custom allowlist** — If domain is in custom allowlist, allowed
2. **Built-in allowlist** — If domain is in source allowlist, allowed
3. **Custom blocklist** — If domain is in custom blocklist, blocked
4. **Disposable list** — If domain matches disposable list, blocked
5. **Default** — Allow

Available Methods
-----------------

[](#available-methods)

MethodReturnsDescription`is_disposable($email)``bool`Check if email is from disposable provider`is_blocked($email)``bool`Check if email is blocked (disposable + custom)`is_allowed($email)``bool`Check if email is in allowlist`block($domains)``self`Add domain(s) to custom blocklist`allow($domains)``self`Add domain(s) to custom allowlist`unblock($domain)``self`Remove domain from custom blocklist`disallow($domain)``self`Remove domain from custom allowlist`get_blocked()``array`Get custom blocked domains`get_custom_allowed()``array`Get custom allowed domains`clear()``self`Clear all custom entries`count()``int`Count of disposable domainsData Source
-----------

[](#data-source)

This library uses data from:

- [disposable-email-domains](https://github.com/disposable-email-domains/disposable-email-domains)

The list contains ~170,000 disposable email domains and is actively maintained.

Requirements
------------

[](#requirements)

- PHP 8.0+

License
-------

[](#license)

GPL-2.0-or-later

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance59

Moderate activity, may be stable

Popularity3

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity11

Early-stage or recently created project

 Bus Factor1

Top contributor holds 83.3% 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.

### Community

Maintainers

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

---

Top Contributors

[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (15 commits)")[![arraypress](https://avatars.githubusercontent.com/u/22668877?v=4)](https://github.com/arraypress "arraypress (3 commits)")

### Embed Badge

![Health badge](/badges/arraypress-email-blocklist/health.svg)

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

###  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)
