PHP code example of khanhicetea / fast-email-validator

1. Go to this page and download the library: Download khanhicetea/fast-email-validator library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

khanhicetea / fast-email-validator example snippets


// Include the composer autoloader
ss;
use FastEmailValidator\EmailValidatorProvider;
use FastEmailValidator\EmailValidator;

$fastEmailValidator = new EmailValidator();

$provider = new EmailValidatorProvider();
$provider->registerValidator(new ValidFormatValidator());
$provider->registerValidator(new DisposableEmailValidator());
$provider->registerValidator(new EmailHostValidator());
$provider->registerValidator(new FreeEmailServiceValidator());
$provider->registerValidator(new MxRecordsValidator());
$provider->registerValidator(new RoleBasedEmailValidator());

$fastEmailValidator->registerEmailValidatorProvider($provider);

$result = $fastEmailValidator->validate(new EmailAddress('[email protected]'));

echo(json_encode($result));