marcel-strahl / temporary-email-validator-bundle
add temporary email address validator for symfony
Installs: 56
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: ^7.4|^8.0|^8.1
- doctrine/annotations: ^1.13
- jprangenbergde/temporary-email-detection: ^1.3
- symfony/dependency-injection: ^5.3|^5.4|^6.0
- symfony/framework-bundle: ^5.3|^5.4|^6.0
- symfony/translation: ^5.3|^5.4|^6.0
- symfony/validator: ^5.3|^5.4|^6.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.8
- matthiasnoback/symfony-dependency-injection-test: ^4.3
- phpstan/phpstan: ^1.5
- phpstan/phpstan-phpunit: ^1.1
- phpstan/phpstan-symfony: ^1.1
- phpstan/phpstan-webmozart-assert: ^1.1
- phpunit/phpunit: ^9.5
- symfony/phpunit-bridge: ^5.3|^5.4|^6.0
README
##Recognition of temporary e-mail addresses as validator for Symfony
It is compatible and tested with PHP 8.+ on Symfony 5.x.
###Installation:
composer require marcel-strahl/temporary-email-validator
If Symfony/Flex is not enabled, the bundle will not be loaded automatically. So it is necessary to enter this in the config/bundes.php
yourself, that you can do with the following line:
return [ // Some other bundles [...] MarcelStrahl\TemporaryEmailValidatorSymfony\TemporaryEmailValidatorBundle::class => ['all' => true], ];
You can easily use the validator via annotation with the help of the doctrine/annotations
bundle.
The following is an annotation example:
namespace App\Controller; use MarcelStrahl\TemporaryEmailValidatorSymfony\Validator\IsNotTemporaryEmail; final class TestDto { /** * @IsNotTemporaryEmail */ private string $email; private function __construct(string $email) { $this->email = $email; } public static function create(string $email): self { return new self($email); } public function getEmail(): string { return $this->email; } }
The following is an attribute example:
namespace App\Controller; use MarcelStrahl\TemporaryEmailValidatorSymfony\Validator\IsNotTemporaryEmail; final class TestDto { #[IsNotTemporaryEmail] private string $email; private function __construct(string $email) { $this->email = $email; } public static function create(string $email): self { return new self($email); } public function getEmail(): string { return $this->email; } }
###Hint:
I am not the creator of the "Temporary Email Detection" but have changed the following package into a Symfony Validator!
Main Package Temporary E-Mail Detection: https://github.com/jprangenbergde/temporary-email-detection
Credits
- Marcel Strahl info@marcel-strahl.de
License
This bundle is under the MIT license.
For the whole copyright, see the LICENSE file distributed with this source code.