marcel-strahl/temporary-email-validator-sf

dev-master 2019-02-07 20:15 UTC

README

Recognition of temporary e-mail addresses as validator for Symfony

Installation:

composer install marcel-strahl/temporary-email-validator-sf

##How to use

Note: It is strongly recommended to use the email constraint first, as this constraint only checks for a temporary email address and not if the value is a valid email address.

use TemporaryEmailValidation\Validator\Contraints\IsNotTemporaryEmail;

$constraint = new IsNotTemporaryEmail();
// $constraint->message = your message

// use the validator to validate the value
$error = $this
    ->get('validator')
    ->validate('mail@0815.ru', $constraint);

$errorMessage = $errorList[0]->getMessage(); // The e-mail address "mail@0815.ru" you enter is a temporary e-mail address.

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