##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
- Marcel Strahl [email protected]
This bundle is under the MIT license.
For the whole copyright, see the LICENSE file distributed with this source code.