Prerequisites
- PHP 8.1+ with
ip-api-io/ipapi-phpinstalled - A free ip-api.io API key
Age of one domain with domainAge
Returns the registration date and the age in years and days.
<?php
use IpApiIo\Client;
$client = new Client(apiKey: getenv('IP_API_IO_KEY'));
$age = $client->domainAge('example.com');
var_dump($age['is_valid']); // true
echo $age['registration_date']; // "1995-08-14"
echo $age['age_in_years']; // 30
echo $age['age_in_days']; // 11000+
if (($age['age_in_days'] ?? PHP_INT_MAX) < 30) {
// treat brand-new domains as higher risk
} Many domains with domainAgeBatch
Check a list of domains in one request (throws if empty).
$batch = $client->domainAgeBatch([
'example.com',
'brand-new-domain.xyz',
]);
foreach ($batch['results'] as $domain => $age) {
echo $domain, ' ', $age['age_in_days'];
}