SDK
PHP RDAP SDK
Look up domains, IPs, and ASNs from PHP. Typed responses, bulk lookups, registrar follow-through.
PHP 8.2 or later
Install
composer require rdapapi/rdapapi-phpFirst request in 60 seconds
Get an API key from the dashboard, then drop your key into the client and call any of the lookup methods.
<?php
use RdapApi\RdapApi;
$api = new RdapApi('your-api-key');
// Domain lookup
$domain = $api->domain('google.com');
echo $domain->registrar->name; // "MarkMonitor Inc."
echo $domain->dates->expires; // "2028-09-14T04:00:00Z"
print_r($domain->nameservers); // ["ns1.google.com", ...]
// IP address lookup
$ip = $api->ip('8.8.8.8');
echo $ip->name; // "GOGL"
print_r($ip->cidr); // ["8.8.8.0/24"]
// ASN lookup
$asn = $api->asn(15169);
echo $asn->name; // "GOOGLE"Bulk domain lookups
Send up to 10 domains in one request. Available on Pro and Business plans.
$resp = $api->bulkDomains(
['google.com', 'github.com', 'example.com'],
['follow' => true],
);
echo $resp->summary->total; // 3
echo $resp->summary->successful; // 3
foreach ($resp->results as $result) {
if ($result->status === 'success') {
echo "{$result->domain}: {$result->data->registrar->name}\n";
}
}Error handling
Every API error maps to a typed exception. Catch NotSupportedException before NotFoundException since it is a subclass.
use RdapApi\Exceptions\NotFoundException;
use RdapApi\Exceptions\NotSupportedException;
use RdapApi\Exceptions\RateLimitException;
try {
$domain = $api->domain('example.nope');
} catch (NotSupportedException $e) {
echo 'The TLD is not covered by RDAP.';
} catch (NotFoundException $e) {
echo 'The domain is not registered.';
} catch (RateLimitException $e) {
echo "Rate limited, retry after {$e->retryAfter} seconds";
}