PHP code example of drinks-it / hippo-email-validator

1. Go to this page and download the library: Download drinks-it/hippo-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/ */

    

drinks-it / hippo-email-validator example snippets


use Nrgone\EmailHippo\Validator\Config;
use Nrgone\EmailHippo\Validator\Validator;
use Symfony\Component\HttpClient\HttpClient;
use Psr\Log\NullLogger;

$config = new Config(
    true,                              // enable validation
    'https://api.emailhippo.com/v3',   // API URL
    'your-api-key',                    // API key
    0.7,                               // minimum hippo trust score
    false                              // disable request logging
);

$validator = new Validator($config, HttpClient::create(), new NullLogger());

if ($validator->isValid('[email protected]')) {
    echo 'Email is valid';
} else {
    echo 'Invalid email';
}