masnathan/domain-api-client

This is an easy way to check domain details.

dev-main 2021-09-30 22:12 UTC

This package is auto-updated.

Last update: 2024-03-29 04:20:02 UTC


README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

This is an easy way to check if a domain is valid, if it’s available for purchase, it's age or it's DNS settings

Request your API key here

Installation

You can install the package via composer:

composer require masnathan/domain-api-client

Usage

Whois

use MASNathan\DomainAPI\Domain;

$domainClient = new Domain('domain-checker7.p.rapidapi.com', 'super-secret-api-key');

$details = $domainClient->whois('github.com');

var_dump($details);
// array:10 [
//   "domain" => "github.com"
//   "sld" => "github"
//   "tld" => "com"
//   "valid" => true
//   "available" => false
//   "created_at" => "2007-10-09 18:20:50"
//   "updated_at" => "2020-09-08 09:18:27"
//   "expires_at" => "2022-10-09 18:20:50"
//   "registrar" => "MarkMonitor, Inc."
//   "whois" => "whois.markmonitor.com"
// ]

// you can also use the batch method to request up to 100 domains

$details = $domainClient->whoisBatch(['github.com', 'rapidapi.com', 'google.com']);

DNS

use MASNathan\DomainAPI\Domain;

$domainClient = new Domain('domain-checker7.p.rapidapi.com', 'super-secret-api-key');

$details = $domainClient->dns('github.com');

var_dump($details);
// array:8 [
//   "domain" => "github.com"
//   "valid" => true
//   "A" => array:1 [
//     0 => "140.82.121.4"
//   ]
//   "AAAA" => []
//   "CNAME" => array:1 [...]
//   "NS" => array:8 [...]
//   "MX" => array:5 [...]
//   "TXT" => array:8 [...]
// ]

// you can also use the batch method to request up to 100 domains

$details = $domainClient->dnsBatch(['github.com', 'rapidapi.com', 'google.com']);

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.