diff --git a/CHANGELOG.md b/CHANGELOG.md index 70b786d..1893f59 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1 +1,9 @@ -// TODO +# Change Log + +All notable changes to `elyby/php-tempmailbuster` are documented in this file using the +[Keep a CHANGELOG](http://keepachangelog.com/) principles. + +## 1.0.0 - 2016-04-30 + +### Added +* Initial release diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..9e6a81f --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,34 @@ +# Contributing + + * Coding standard for the project is [PSR-2](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md) + * Any contribution must provide tests for additional introduced conditions + +## Installation + +To install the project and run the tests, you need to clone it first: + +```sh +$ git clone git@github.com:elyby/php-tempmailbuster.git +``` + +You will then need to run a composer installation: + +```sh +$ cd php-tempmailbuster +$ curl -s https://getcomposer.org/installer | php +$ php composer.phar update +``` + +## Testing + +The PHPUnit version to be used is the one installed as a dev- dependency via composer: + +```sh +$ ./vendor/bin/phpunit +``` + +or + +```sh +$ composer test +``` diff --git a/README.md b/README.md index 70b786d..4c028a6 100644 --- a/README.md +++ b/README.md @@ -1 +1,66 @@ -// TODO +# PHP Tempmail Buster + +[![Software License][ico-license]](LICENSE.md) + +Расширяемый класс для блокировки E-mail адресов определённых доменов или организации белого списка допустимых доменов. +Реализует лоадер для загрузки и валидации по списку из [Anti Tempmail Repo](https://github.com/elyby/anti-tempmail-repo). + +## Установка + +Install the latest version with + +```sh +$ composer require ely/php-tempmailbuster +``` + +## Использование + +Пример использования с применением стандартного лоадера: + +```php +use Ely\TempMailBuster\Loader\AntiTempmailRepo; +use Ely\TempMailBuster\Storage; +use Ely\TempMailBuster\Validator; + +// Создаём класс лоадера +$loader = new AntiTempmailRepo(); +// Загружаем из него данные и передаём их в объект хранилища +$storage = new Storage($loader->load(); +// или используем статичный метод для работы с лоадерами +$storage = Storage::fromLoader($loader); +// Создаём класс-валидатор +$validator = new Validator($storage); +$validator->validate('team@ely.by'); // = true +$validator->validate('hy42k@sendspamhere.com'); // = false + +// Включаем режим белого списка +$validator->whitelistMode(); +$validator->validate('team@ely.by'); // = false +$validator->validate('hy42k@sendspamhere.com'); // = true +``` + +Конструктор принимает 2 аргумента: первичное и вторичное хранилище. Первичное хранилище работает в соответствии с +выбранным режимом работы библиотеки, а вторичное (если указано) позволяет добавить исключение из правил. Смотрите +больше примеров вызова метода `validate()` в [тестах](tests/ValidatorTest.php). + +## 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. + +[ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square + +[link-author]: https://github.com/ErickSkrauch +[link-contributors]: ../../contributors diff --git a/composer.json b/composer.json index 4055333..cceb66a 100644 --- a/composer.json +++ b/composer.json @@ -1,16 +1,22 @@ { "name": "ely/php-tempmailbuster", + "description": "Control emails with black and white lists; make lists of domains using regular expressions and validate emails with them", + "keywords": ["email", "validation"], + "homepage": "https://github.com/elyby/anti-tempmail-repo", "license": "MIT", "type": "library", "authors": [ + { + "name": "Ely.by team", + "email": "team@ely.by" + }, { "name": "ErickSkrauch", "email": "erickskrauch@ely.by" } ], "require": { - "php" : "~5.4|~7.0", - "lib-curl" : "*", + "php" : "~5.4 | ~7.0", "ely/anti-tempmail-repo" : "*" }, "require-dev": { @@ -23,7 +29,7 @@ "name": "ely/anti-tempmail-repo", "version": "0.0.0", "source": { - "url": "https://github.com/elyby/anti-tempmail-repo", + "url": "https://github.com/elyby/anti-tempmail-repo.git", "type": "git", "reference": "master" }