Control emails with black and white lists; make lists of domains using regular expressions and validate emails with them

PHP Tempmail Buster

Latest Version on Packagist Software License Total Downloads

A package to protect your application from users with temp emails. Uses Anti Tempmail Repo as a default blacklist source. Provides an extendable class for E-mail validation based on black- or whitelist.


Install the latest version with

$ composer require ely/php-tempmailbuster


Validation example using default loader:

use Ely\TempMailBuster\Loader\AntiTempmailRepo;
use Ely\TempMailBuster\Storage;
use Ely\TempMailBuster\Validator;

$loader = new AntiTempmailRepo();
// A storage can be instantiated by feeding it with an array of patterns:
$storage = new Storage($loader->load());
// or created from loader instance
$storage = Storage::fromLoader($loader);

$validator = new Validator($storage);
$validator->validate(''); // = true
$validator->validate(''); // = false

// Enable whitelisting mode
$validator->validate(''); // = false
$validator->validate(''); // = true

Validator constructor accepts 2 arguments: primary and secondary storages. Primary storage is used for validation based on current mode (whitelist/blacklist). Secondary storage (if provided) allows you to add exceptions from primary storage rules.

For more usage examples please take a look on tests.

Change log

Please see CHANGELOG for more information what has changed recently.


Please see CONTRIBUTING for details.


This package was designed and developed within the project team. We also thank all the contributors for their help.


The MIT License (MIT). Please see License File for more information.