gemorroj/whordap

WHOIS/RDAP client

2.0.0 2025-04-05 16:54 UTC

This package is auto-updated.

Last update: 2025-04-05 18:28:37 UTC


README

License Latest Stable Version Continuous Integration

Features:

  • WHOIS/RDAP info for domains, IPv4/IPv6, CIDR, ASN
  • Support national domains (президент.рф for example)
  • Follow to registrar WHOIS/RDAP servers (whois.crsnic.net -> whois.nic.ru for example)
  • Force custom WHOIS/RDAP server

Requirements:

  • PHP >= 8.4
  • ext-curl

Installation:

composer require gemorroj/whordap

Example:

<?php
use WhoRdap\NetworkClient\NetworkClient;
use WhoRdap\WhoRdap;
use WhoRdap\Response\WhoisDomainRegistrarResponse;
use WhoRdap\Response\WhoisDomainResponse;
use Psr\Log\NullLogger;
use Symfony\Component\Cache\Adapter\FilesystemAdapter;

$logger = new NullLogger();
$cache = new FilesystemAdapter('whordap', 60); // install symfony/cache

$networkClient = new NetworkClient(cache: $cache, logger: $logger);
$whois = new WhoRdap($networkClient);
// $data = $whois->processWhois('ru');
// $data = $whois->processRdap('ru');
// $data = $whois->processWhois('127.0.0.1');
// $data = $whois->processWhois('192.168.0.0/24'); // CIDR
// $data = $whois->processWhois('2001:0db8:85a3:0000:0000:8a2e:0370:7334');
// $data = $whois->processWhois('AS220');
// $data = $whois->processWhois('sirus.su', 'whois.tcinet.ru'); // custom WHOIS server
// $data = $whois->processRdap('sirus.su', 'https://www.nic.ru/rdap'); // custom RDAP server
$data = $whois->processWhois('vk.com');
$actualResponse = $data instanceof WhoisDomainResponse && $data->registrarResponse instanceof WhoisDomainRegistrarResponse ? $data->registrarResponse : $data;
// echo $actualResponse->response;

print_r($data);
/*
WhoRdap\Response\WhoisDomainResponse Object
(
    [response] => Domain Name: VK.COM
   Registry Domain ID: 3206186_DOMAIN_COM-VRSN
   Registrar WHOIS Server: whois.nic.ru
...
    [server] => whois.verisign-grs.com
    [registrarResponse] => WhoRdap\Response\WhoisDomainRegistrarResponse Object
        (
            [response] => Domain Name: VK.COM
Registry Domain ID: 3206186_DOMAIN_COM-VRSN
Registrar WHOIS Server: whois.nic.ru
...
            [server] => whois.nic.ru
        )
)
 */

Notes: