PHPackages                             gemorroj/phpwhois2 - 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. gemorroj/phpwhois2

Abandoned → [gemorroj/whordap](/?search=gemorroj%2Fwhordap)ArchivedLibrary[Utility &amp; Helpers](/categories/utility)

gemorroj/phpwhois2
==================

PHPWhois2 - library for querying whois services and parsing results.

16PHPCI passing

Since Apr 5Pushed 1y ago1 watchersCompare

[ Source](https://github.com/Gemorroj/phpwhois2)[ Packagist](https://packagist.org/packages/gemorroj/phpwhois2)[ RSS](/packages/gemorroj-phpwhois2/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

USE  instead

Introduction
------------

[](#introduction)

This package contains a Whois (RFC954) library for PHP. It allows a PHP program to create a Whois object, and obtain the output of a whois query with the `lookup` function.

The response is an array containing, at least, an element 'rawData', containing the raw output from the whois request.

It fully supports IDNA (internationalized) domains names as defined in RFC3490, RFC3491, RFC3492 and RFC3454.

It also supports ip/AS whois queries which are very useful to trace SPAM. You just only need to pass the doted quad ip address or the AS (Autonomus System) handle instead of the domain name. Limited, non-recursive support for Referral Whois (RFC 1714/2167) is also provided.

Requirements
------------

[](#requirements)

PHPWhois2 requires PHP 8.2 or better with OpenSSL support to work properly.

Without SSL support you will not be able to query domains which do not have a whois server but that have a https based whois.

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

[](#installation)

```
composer require gemorroj/phpwhois2
```

Example usage
-------------

[](#example-usage)

```
use PHPWhois2\Whois;

$whois = new Whois();
$result = $whois->lookup('example.com');
print_r($result);
echo Whois::showHTML($result);
```

What you can query
------------------

[](#what-you-can-query)

You can use PHPWhois2 to query domain names, ip addresses and other information like AS, i.e, both of the following examples work:

```
use PHPWhois2\Whois;

$whois = new Whois();
$result = $whois->lookup('example.com');

$whois = new Whois();
$result = $whois->lookup('62.97.102.115');

$whois = new Whois();
$result = $whois->lookup('AS220');
```

Using special whois server
--------------------------

[](#using-special-whois-server)

Some registrars can give special access to registered whois gateways in order to have more fine control against abusing the whois services. The currently known whois services that offer special acccess are:

### ripe

[](#ripe)

The new ripe whois server software support some special parameters that allow to pass the real client ip address. This feature is only available to registered gateways. If you are registered you can use this service when querying ripe ip addresses that way:

```
use PHPWhois2\Whois;
use PHPWhois2\WhoisClient;
use PHPWhois2\QueryParams;

$queryParams = new QueryParams();
$queryParams->tldWhoisServer['uk'] = 'whois.ripe.net?-V{version},{ip} {query}';

$whois = new Whois(new WhoisClient($queryParams));
$result = $whois->lookup('62.97.102.115');
```

### whois.isoc.org.il

[](#whoisisocorgil)

This server is also using the new ripe whois server software and thus works the same way. If you are registered you can use this service when querying `.il` domains that way:

```
use PHPWhois2\Whois;
use PHPWhois2\WhoisClient;
use PHPWhois2\QueryParams;

$queryParams = new QueryParams();
$queryParams->tldWhoisServer['uk'] = 'whois.isoc.org.il?-V{version},{ip} {query}';

$whois = new Whois(new WhoisClient($queryParams));
$result = $whois->lookup('example.co.uk');
```

### whois.nic.uk

[](#whoisnicuk)

They offer what they call WHOIS2 (see  ) to registered users (usually Nominet members) with a higher amount of permitted queries by hour. If you are registered you can use this service when querying .uk domains that way:

```
use PHPWhois2\Whois;
use PHPWhois2\WhoisClient;
use PHPWhois2\QueryParams;

$queryParams = new QueryParams();
$queryParams->tldWhoisServer['uk'] = 'whois.nic.uk:1043?{hname} {ip} {query}';

$whois = new Whois(new WhoisClient($queryParams));
$result = $whois->lookup('example.co.uk');
```

This new feature also allows you to use a different whois server than the preconfigured or discovered one by just calling whois-&gt;useWhoisServer and passing the tld and the server and args to use for the named tld. For example, you could use another whois server for `.au` domains that does not limit the number of requests (but provides no owner information) using this:

```
use PHPWhois2\Whois;
use PHPWhois2\WhoisClient;
use PHPWhois2\QueryParams;

$queryParams = new QueryParams();
$queryParams->tldWhoisServer['au'] = 'whois-check.ausregistry.net.au';
// to avoid the restrictions imposed by the `.be` whois server
$queryParams->tldWhoisServer['be'] = 'whois.tucows.com';

$whois = new Whois(new WhoisClient($queryParams));
```

UTF-8
-----

[](#utf-8)

PHPWhois2 will assume that all whois servers return UTF-8 encoded output, if some whois server does not return UTF-8 data, you can pass it in the `nonUtf8Servers` array in `QueryParams`:

```
use PHPWhois2\Whois;
use PHPWhois2\WhoisClient;
use PHPWhois2\QueryParams;

$queryParams = new QueryParams();
$queryParams->nonUtf8Servers[] = 'br.whois-servers.net';

$whois = new Whois(new WhoisClient($queryParams));
```

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance35

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity15

Early-stage or recently created project

 Bus Factor1

Top contributor holds 60% of commits — single point of failure

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/3a795fd41706f01fce8e4bd081fa506396eb849bf8ac299420e9be8b48d8d20f?d=identicon)[Gemorroj](/maintainers/Gemorroj)

---

Top Contributors

[![kevinoo](https://avatars.githubusercontent.com/u/2440395?v=4)](https://github.com/kevinoo "kevinoo (45 commits)")[![Gemorroj](https://avatars.githubusercontent.com/u/885731?v=4)](https://github.com/Gemorroj "Gemorroj (19 commits)")[![abcdmitry](https://avatars.githubusercontent.com/u/1550918?v=4)](https://github.com/abcdmitry "abcdmitry (5 commits)")[![pcastelovigo](https://avatars.githubusercontent.com/u/20586382?v=4)](https://github.com/pcastelovigo "pcastelovigo (3 commits)")[![DavidAnderson684](https://avatars.githubusercontent.com/u/1962275?v=4)](https://github.com/DavidAnderson684 "DavidAnderson684 (1 commits)")[![danyaPostfactum](https://avatars.githubusercontent.com/u/1527097?v=4)](https://github.com/danyaPostfactum "danyaPostfactum (1 commits)")[![theodorejb](https://avatars.githubusercontent.com/u/3053271?v=4)](https://github.com/theodorejb "theodorejb (1 commits)")

### Embed Badge

![Health badge](/badges/gemorroj-phpwhois2/health.svg)

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

###  Alternatives

[sunel/eav

Eav For Artisan.

1533.6k1](/packages/sunel-eav)[coreproc/laravel-wallet-plus

Easily add a virtual wallet to your Laravel models. Features multiple wallets and a ledger system to help keep track of all transactions in the wallets.

2914.6k](/packages/coreproc-laravel-wallet-plus)[tarsana/functional

functional programming library for PHP

542.1k1](/packages/tarsana-functional)

PHPackages © 2026

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