2016-04-30 23:44:37 +05:30
|
|
|
# PHP Tempmail Buster
|
|
|
|
|
2016-04-30 23:59:37 +05:30
|
|
|
[![Latest Version on Packagist][ico-version]][link-packagist]
|
2016-04-30 23:44:37 +05:30
|
|
|
[![Software License][ico-license]](LICENSE.md)
|
2016-04-30 23:59:37 +05:30
|
|
|
[![Total Downloads][ico-downloads]][link-downloads]
|
2016-04-30 23:44:37 +05:30
|
|
|
|
2016-05-01 21:31:50 +05:30
|
|
|
A package to protect your application from users with temp emails. Uses
|
|
|
|
[Anti Tempmail Repo](https://github.com/elyby/anti-tempmail-repo) as a default blacklist source. Provides an extendable
|
|
|
|
class for E-mail validation based on black- or whitelist.
|
2016-04-30 23:44:37 +05:30
|
|
|
|
2016-05-01 11:51:54 +05:30
|
|
|
## Intallation
|
2016-04-30 23:44:37 +05:30
|
|
|
|
|
|
|
Install the latest version with
|
|
|
|
|
|
|
|
```sh
|
|
|
|
$ composer require ely/php-tempmailbuster
|
|
|
|
```
|
|
|
|
|
2016-05-01 11:51:54 +05:30
|
|
|
## Usage
|
2016-04-30 23:44:37 +05:30
|
|
|
|
2016-05-01 11:51:54 +05:30
|
|
|
Validation example using default loader:
|
2016-04-30 23:44:37 +05:30
|
|
|
|
|
|
|
```php
|
|
|
|
use Ely\TempMailBuster\Loader\AntiTempmailRepo;
|
|
|
|
use Ely\TempMailBuster\Storage;
|
|
|
|
use Ely\TempMailBuster\Validator;
|
|
|
|
|
|
|
|
$loader = new AntiTempmailRepo();
|
2016-05-01 11:51:54 +05:30
|
|
|
// A storage can be instantiated by feeding it with an array of patterns:
|
|
|
|
$storage = new Storage($loader->load());
|
|
|
|
// or created from loader instance
|
2016-04-30 23:44:37 +05:30
|
|
|
$storage = Storage::fromLoader($loader);
|
2016-05-01 11:51:54 +05:30
|
|
|
|
2016-04-30 23:44:37 +05:30
|
|
|
$validator = new Validator($storage);
|
|
|
|
$validator->validate('team@ely.by'); // = true
|
|
|
|
$validator->validate('hy42k@sendspamhere.com'); // = false
|
|
|
|
|
2016-05-01 11:51:54 +05:30
|
|
|
// Enable whitelisting mode
|
2016-04-30 23:44:37 +05:30
|
|
|
$validator->whitelistMode();
|
|
|
|
$validator->validate('team@ely.by'); // = false
|
|
|
|
$validator->validate('hy42k@sendspamhere.com'); // = true
|
|
|
|
```
|
|
|
|
|
2016-05-01 21:31:50 +05:30
|
|
|
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.
|
2016-05-01 11:51:54 +05:30
|
|
|
|
|
|
|
For more usage examples please take a look on [tests](tests/ValidatorTest.php).
|
2016-04-30 23:44:37 +05:30
|
|
|
|
|
|
|
## Change log
|
|
|
|
|
|
|
|
Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.
|
|
|
|
|
|
|
|
## Contributing
|
|
|
|
|
|
|
|
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
|
|
|
|
|
|
|
|
## Credits
|
|
|
|
|
|
|
|
This package was designed and developed within the [Ely.by](http://ely.by) project team. We also thank all the
|
|
|
|
[contributors](link-contributors) for their help.
|
|
|
|
|
|
|
|
## License
|
|
|
|
|
|
|
|
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
|
|
|
|
|
2016-04-30 23:59:37 +05:30
|
|
|
[ico-version]: https://img.shields.io/packagist/v/ely/php-tempmailbuster.svg?style=flat-square
|
2016-04-30 23:44:37 +05:30
|
|
|
[ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square
|
2016-04-30 23:59:37 +05:30
|
|
|
[ico-downloads]: https://img.shields.io/packagist/dt/ely/php-tempmailbuster.svg?style=flat-square
|
2016-04-30 23:44:37 +05:30
|
|
|
|
2016-05-01 00:00:51 +05:30
|
|
|
[link-packagist]: https://packagist.org/packages/ely/php-tempmailbuster
|
2016-04-30 23:44:37 +05:30
|
|
|
[link-author]: https://github.com/ErickSkrauch
|
|
|
|
[link-contributors]: ../../contributors
|
2016-05-01 00:00:51 +05:30
|
|
|
[link-downloads]: https://packagist.org/packages/ely/php-tempmailbuster
|