marcel-strahl / temporary-email-validator-bundle
此包已被废弃且不再维护。未建议替代包。
为symfony添加临时电子邮件地址验证器
v1.1.0
2022-03-29 19:30 UTC
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
##将临时电子邮件地址识别为Symfony的验证器
此包与PHP 8.+在Symfony 5.x上兼容并经过测试。
###安装
composer require marcel-strahl/temporary-email-validator
如果未启用Symfony/Flex,则不会自动加载此包。因此,您需要自己将以下内容添加到config/bundles.php
中,可以使用以下行完成此操作
return [ // Some other bundles [...] MarcelStrahl\TemporaryEmailValidatorSymfony\TemporaryEmailValidatorBundle::class => ['all' => true], ];
您可以通过使用doctrine/annotations
包中的注解轻松使用验证器。以下是一个注解示例
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; } }
以下是一个属性示例
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; } }
###提示
我不是“临时电子邮件检测”的创建者,但我已将以下包改造成了一个Symfony验证器!
主要包临时电子邮件检测: https://github.com/jprangenbergde/temporary-email-detection
鸣谢
- Marcel Strahl info@marcel-strahl.de
许可协议
此包采用MIT许可协议。
有关整个版权信息,请参阅与此源代码一起分发的LICENSE文件。