PHP code example of addrlyq / addrly-php

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

    

addrlyq / addrly-php example snippets



ent = new \Addrly\Addrly('sk_your_api_key');

// Validate an email
$result = $client->validateEmail('[email protected]');
echo $result['mx'];         // true
echo $result['disposable'];  // false

// Validate a domain
$domain = $client->validateDomain('example.com');

// Auto-detect (email or domain)
$auto = $client->validate('[email protected]');

// Bulk email validation (Pro: 500, Ultra: 1000)
$bulk = $client->bulkValidateEmails([
    '[email protected]',
    '[email protected]',
    '[email protected]',
]);
print_r($bulk['summary']);

// Bulk domain validation
$domains = $client->bulkValidateDomains(['gmail.com', 'tempmail.com']);

$decision = $client->gate('gate_abc123def456', [
    'email' => '[email protected]',
]);
echo $decision['decision']['action']; // "block"

use Addrly\AddrlyException;

try {
    $result = $client->validateEmail('[email protected]');
} catch (AddrlyException $e) {
    echo $e->getStatus();    // 429
    echo $e->getError();     // "Rate limit exceeded"
    print_r($e->getResponse());
}
bash
composer