2017 © Pedro Peláez
 

library domain

Check domain name availability and WHOIS

image

cocur/domain

Check domain name availability and WHOIS

  • Wednesday, March 21, 2018
  • by florianeckerstorfer
  • Repository
  • 3 Watchers
  • 41 Stars
  • 1,024 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 14 Forks
  • 0 Open issues
  • 4 Versions
  • 1 % Grown

The README.md

cocur/domain

Check availability of domain names and get WHOIS information., (*1)

Latest Stable Version Build Status Code Coverage, (*2)

Features

  • Check availability of domains
  • Retrieve WHOIS information of domains
  • Support for over 350 TLDs, including new generic TLDs like .coffee or .sexy
  • Command line tool and library
  • Compatible with PHP >= 5.4 and HHVM

Installation

Dependending on how you want to use Domain there exist different installation methods., (*3)

Composer

If you want to use the library as a dependency in your project you should use Composer to do so:, (*4)

$ composer require cocur/domain:@dev

Currently there exists no stable release of domain., (*5)

Download PHAR

If you only want to use the command line tool to retrieve WHOIS information you can download the PHAR., (*6)

$ wget https://github.com/cocur/domain/releases/download/v0.1/whois.phar
$ chmod +x whois.phar
$ mv whois.phar /usr/local/bin/cwhois

You can now retrieve WHOIS information using Cocur Domain by executing, (*7)

$ cwhois

Usage

Command line WHOIS

You can use the included command line tool to retrieve WHOIS information about a domain:, (*8)

$ php whois.phar cocur.co

Library

The library contains two main classes: Whois\Client and Availability\Client They require information about WHOIS servers and patterns to match available domains stored in data/tld.json., (*9)

Whois

use Cocur\Domain\Connection\ConnectionFactory;
use Cocur\Domain\Data\DataLoader;
use Cocur\Domain\Whois\Client;

$factory = new ConnectionFactory();
$dataLoader = new DataLoader();
$data = $dataLoader->load(__DIR__.'/data/tld.json');

$client = new Client($factory, $data);

echo $client->query($domainName);

Availability

To check the availability of a domain name the Availability\Client requires an instance of Whois\Client., (*10)

use Cocur\Domain\Connection\ConnectionFactory;
use Cocur\Domain\Data\DataLoader;
use Cocur\Domain\Whois\Client as WhoisClient;
use Cocur\Domain\Availability\Client as AvailabilityClient;

$factory = new ConnectionFactory();
$dataLoader = new DataLoader();
$data = $dataLoader->load(__DIR__.'/data/tld.json');

$whoisClient = new WhoisClient($factory, $data);
$client = new AvailabilityClient($whoisClient, $data);

echo $client->isAvailable($domainName);

Changelog

Verison 0.2 (15 June 2016)

Version 0.1 (19 May 2014)

  • Initial release

Author

Florian Eckerstorfer Support Florian

License

The MIT license applies to cocur/domain. For the full copyright and license information, please view the LICENSE file distributed with this source code., (*11)

The Versions

21/03 2018

dev-master

9999999-dev

Check domain name availability and WHOIS

  Sources   Download

MIT

The Requires

 

The Development Requires

domain whois

15/06 2016

0.2.x-dev

0.2.9999999.9999999-dev

Check domain name availability and WHOIS

  Sources   Download

MIT

The Requires

 

The Development Requires

domain whois

15/06 2016
19/05 2014