PHP code example of easyemailverification / php-sdk

1. Go to this page and download the library: Download easyemailverification/php-sdk 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/ */

    

easyemailverification / php-sdk example snippets


use EasyEmailVerification\Client;

// Use Client::SANDBOX_API_KEY to try it, or your own key (by default read from EEV_API_KEY)
$eev = new Client(Client::SANDBOX_API_KEY);

$r = $eev->verify('[email protected]');
echo $r['result'], ' ', $r['reason'], "\n";   // valid accepted_email
echo Client::decide($r), "\n";                  // accept

foreach ($eev->verifyBatch(['[email protected]', '[email protected]']) as $r) {
    echo $r['email'], ' ', Client::decide($r), "\n";
}

$job  = $eev->bulk->upload('leads.csv');           // a path; or upload($csvText, 'leads.csv', true)
$done = $eev->bulk->wait($job['list_id']);         // polls until completed (or failed)
if ($done['status'] === 'completed') {
    $csv = $eev->bulk->download($job['list_id']);  // Email,Result,Reason,...,IsSafeToSend,DidYouMean,...
}
$eev->bulk->list();                                // all jobs of the account
$eev->bulk->delete($job['list_id']);               // results are also deleted after 30 days

echo $eev->credits()['credits_remaining'];  // free call

use EasyEmailVerification\EEVException;

try {
    $eev->verify('[email protected]');
} catch (EEVException $e) {
    if ($e->getStatus() === 402) {
        // no credits left
    }
}
bash
composer