PHPackages                             cocur/domain - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. cocur/domain

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

cocur/domain
============

Check domain name availability and WHOIS

v0.2(9y ago)691.3k20MITPHPPHP &gt;=5.5

Since May 19Pushed 8y ago4 watchersCompare

[ Source](https://github.com/cocur/domain)[ Packagist](https://packagist.org/packages/cocur/domain)[ RSS](/packages/cocur-domain/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (2)Dependencies (7)Versions (4)Used By (0)

cocur/domain
============

[](#cocurdomain)

> Check availability of domain names and get WHOIS information.

[![Latest Stable Version](https://camo.githubusercontent.com/7014b3a7927c07836b16bcb9cdcc08b9f048e5ebc1f2df2ba04c2746df484aa0/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f636f6375722f646f6d61696e2e737667)](https://packagist.org/packages/cocur/domain)[![Build Status](https://camo.githubusercontent.com/f073556a8f9916e05737bbf97f4a9e929d7554b29a3c02877329a071dde64cc3/687474703a2f2f696d672e736869656c64732e696f2f7472617669732f636f6375722f646f6d61696e2e737667)](https://travis-ci.org/cocur/domain)[![Code Coverage](https://camo.githubusercontent.com/fd3996974fb2c24679224c5c691360784096a0ac8a4d581ddf9f7bebddf0ddfe/687474703a2f2f696d672e736869656c64732e696f2f636f766572616c6c732f636f6375722f646f6d61696e2e737667)](https://coveralls.io/r/cocur/domain)

Features
--------

[](#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 &gt;= 5.4 and [HHVM](http://hhvm.com)

Installation
------------

[](#installation)

Dependending on how you want to use Domain there exist different installation methods.

### Composer

[](#composer)

If you want to use the library as a dependency in your project you should use Composer to do so:

```
$ composer require cocur/domain:@dev
```

*Currently there exists no stable release of domain.*

### Download PHAR

[](#download-phar)

If you only want to use the command line tool to retrieve WHOIS information you can download the PHAR.

```
$ 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

```
$ cwhois
```

Usage
-----

[](#usage)

### Command line WHOIS

[](#command-line-whois)

You can use the included command line tool to retrieve WHOIS information about a domain:

```
$ php whois.phar cocur.co
```

### Library

[](#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`.

#### Whois

[](#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

[](#availability)

To check the availability of a domain name the `Availability\Client` requires an instance of `Whois\Client`.

```
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
---------

[](#changelog)

### Verison 0.2 (15 June 2016)

[](#verison-02-15-june-2016)

- [\#1](https://github.com/cocur/domain/pull/1) Add `.frl` TLD (by [rskuipers](https://github.com/rskuipers))
- [\#3](https://github.com/cocur/domain/pull/3) Add `.amsterdam` TLD (by [rskuipers](https://github.com/rskuipers))
- [\#4](https://github.com/cocur/domain/pull/4) Fix pattern for `.ee` (by [huglester](https://github.com/huglester))

### Version 0.1 (19 May 2014)

[](#version-01-19-may-2014)

- Initial release

Author
------

[](#author)

### [Florian Eckerstorfer](http://florian.ec) [![Support Florian](https://camo.githubusercontent.com/5d8be0f60738f32a93128d94dec1fa7ee75e6dce71b110ec7fbbf6d217c0a150/687474703a2f2f696d672e736869656c64732e696f2f6769747469702f666c6f7269616e65636b657273746f726665722e737667)](https://www.gittip.com/FlorianEckerstorfer/)

[](#florian-eckerstorfer-)

- [Twitter](http://twitter.com/Florian_)
- [App.net](http://app.net/florian)

License
-------

[](#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.

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity31

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~379 days

Total

3

Last Release

3624d ago

PHP version history (2 changes)v0.1PHP &gt;=5.4

0.2.x-devPHP &gt;=5.5

### Community

Maintainers

![](https://www.gravatar.com/avatar/a80f9fc61cd3a7d7779e8f120b458ca4d18fdd885d719bb77d3379b96bf714d9?d=identicon)[florianeckerstorfer](/maintainers/florianeckerstorfer)

---

Top Contributors

[![florianeckerstorfer](https://avatars.githubusercontent.com/u/149201?v=4)](https://github.com/florianeckerstorfer "florianeckerstorfer (2 commits)")[![rskuipers](https://avatars.githubusercontent.com/u/1918518?v=4)](https://github.com/rskuipers "rskuipers (2 commits)")[![andreybolonin](https://avatars.githubusercontent.com/u/2576509?v=4)](https://github.com/andreybolonin "andreybolonin (1 commits)")[![huglester](https://avatars.githubusercontent.com/u/150731?v=4)](https://github.com/huglester "huglester (1 commits)")

---

Tags

domainwhois

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/cocur-domain/health.svg)

```
[![Health](https://phpackages.com/badges/cocur-domain/health.svg)](https://phpackages.com/packages/cocur-domain)
```

###  Alternatives

[phpwhois/phpwhois

phpWhois - library for querying whois services and parsing results. Based on phpwhois.org

322392.6k1](/packages/phpwhois-phpwhois)[novutec/whoisparser

Lookup domain names, IP addresses and AS numbers by WHOIS.

392.0M1](/packages/novutec-whoisparser)[helgesverre/domain-availability

A PHP library for checking if a domain name is registered or not

26618.4k1](/packages/helgesverre-domain-availability)[aura/payload

A Domain Payload implementation.

56370.4k9](/packages/aura-payload)[aura/payload-interface

An interface package for Domain Payload implementations.

13392.7k4](/packages/aura-payload-interface)[mallardduck/whois-client

A very basic Whois client for PHP. The library is limited in function since it's intended to be a low-level client that handles only request and raw output.

162.0k3](/packages/mallardduck-whois-client)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
