Control emails with black and white lists; make lists of domains using regular expressions and validate emails with them
Go to file
2016-05-01 19:01:50 +03:00
src Used setters into class constructors 2016-04-30 12:26:39 +03:00
tests Removed redundant feature from AntiTempmailRepo class 2016-04-30 12:24:24 +03:00
.gitignore Initial commit: base git repo structure, base Storage implementation and tests 2016-04-26 23:29:38 +03:00
CHANGELOG.md The initial description of the repository, preparation for publishing on packagist 2016-04-30 21:14:37 +03:00
composer.json anti-tempmail-repo is now published on packagist, so we don't need to require package from repository 2016-05-01 19:00:09 +03:00
CONTRIBUTING.md The initial description of the repository, preparation for publishing on packagist 2016-04-30 21:14:37 +03:00
LICENSE.md Initial commit: base git repo structure, base Storage implementation and tests 2016-04-26 23:29:38 +03:00
phpunit.xml.dist Initial commit: base git repo structure, base Storage implementation and tests 2016-04-26 23:29:38 +03:00
README.md Fixed line length 2016-05-01 19:01:50 +03:00

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.

Intallation

Install the latest version with

$ composer require ely/php-tempmailbuster

Usage

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('team@ely.by'); // = true
$validator->validate('hy42k@sendspamhere.com'); // = false

// Enable whitelisting mode
$validator->whitelistMode();
$validator->validate('team@ely.by'); // = false
$validator->validate('hy42k@sendspamhere.com'); // = 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.

Contributing

Please see CONTRIBUTING for details.

Credits

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

License

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