PHP code example of apiddress / sdk
1. Go to this page and download the library: Download apiddress/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/ */
apiddress / sdk example snippets
use Apiddress\Client;
$client = new Client($_ENV['APIDDRESS_API_KEY']);
$result = $client->validateEmail('[email protected] ');
echo $result->status; // "valid"
echo $result->score; // 0.98
$client = new Client(
apiKey: 'YOUR_API_KEY',
baseUrl: 'https://api.apiddress.com', // default
timeout: 10, // per-request timeout (seconds), default 10
maxRetries: 2, // retries on 429/5xx, default 2
);
$result = $client->validateEmail(
'[email protected] ',
checkSmtp: false, // default
allowRoleBased: true, // server default
);
// $result->status: "valid" | "invalid" | "risky" | "disposable" | "unknown"
// $result->suggestion: "[email protected] " for typo-like addresses, else null
// $result->checks: ValidationChecks { syntax, domain_exists, mx, smtp, disposable, ... }
$response = $client->validateEmails(['[email protected] ', '[email protected] ']);
echo $response->count;
foreach ($response->results as $r) {
echo $r->email . ' ' . $r->status . PHP_EOL;
}
$batch = $client->createBatch(
$emails,
callbackUrl: 'https://yourapp.com/webhooks/apiddress', // optional
);
$done = $client->waitForBatch(
$batch->batch_id,
pollInterval: 1.0, // default
timeout: 60.0, // default
);
echo $done->status . ' ' . count($done->results);
// Or poll yourself:
$status = $client->getBatch($batch->batch_id);
$profile = $client->me(); // plan, limits, usage
$usage = $client->usage(); // current month
$may = $client->usage('2026-05'); // specific month
$health = $client->health(); // no auth
use Apiddress\APIddressError;
use Apiddress\Client;
try {
$client->validateEmail('[email protected] ');
} catch (APIddressError $err) {
echo $err->status; // 429
echo $err->code; // "quota_exceeded"
echo $err->getMessage(); // "Monthly request limit exceeded."
var_dump($err->details); // ["requests_used" => ..., "requests_limit" => ...]
}