PHPackages                             inbox/tld-database - 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. [Database &amp; ORM](/categories/database)
4. /
5. inbox/tld-database

ActiveLibrary[Database &amp; ORM](/categories/database)

inbox/tld-database
==================

Database abstraction for Public Suffix List

10.71(3y ago)071Apache-2.0PHPPHP ^5.5.0 || ^7.0 || ^8.0

Since Jun 16Pushed 3y agoCompare

[ Source](https://github.com/jmalinens/TLDDatabase)[ Packagist](https://packagist.org/packages/inbox/tld-database)[ RSS](/packages/inbox-tld-database/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (2)Dependencies (6)Versions (73)Used By (1)

DEPRECATED
==========

[](#deprecated)

Please use .

 [![](https://github.com/layershifter/TLDDatabase/raw/master/logo.png)](https://github.com/layershifter/TLDDatabase/raw/master/logo.png)

 TLDDatabase
=============

[](#--tlddatabase)

 [ ![Packagist.org](https://camo.githubusercontent.com/10e648e1ec1f952f92f68d5c30aa96c9b0394f94e55fbbe485c8733590a852f6/68747470733a2f2f706f7365722e707567782e6f72672f6c61796572736869667465722f746c642d64617461626173652f762f737461626c65) ](https://packagist.org/packages/layershifter/tld-database) [ ![Build Status](https://camo.githubusercontent.com/c3df8730a40d815c3d8e57bd95e8d16c25802dcd17cbce7e74527dff077a92ac/68747470733a2f2f7472617669732d63692e6f72672f6c61796572736869667465722f544c4444617461626173652e737667) ](https://travis-ci.org/layershifter/TLDDatabase) [ ![Code Climate](https://camo.githubusercontent.com/540e1bb31f1dba380311f9c6aeb9c995b1d5dbcea35161cfba4bf493d7266055/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f6c61796572736869667465722f544c4444617461626173652f6261646765732f6770612e737667) ](https://codeclimate.com/github/layershifter/TLDDatabase) [ ![codecov](https://camo.githubusercontent.com/6ae25c3abbad3dbfe496bef345b0a2349cdd72b096f566e2566cbedb41838c63/68747470733a2f2f636f6465636f762e696f2f67682f6c61796572736869667465722f544c4444617461626173652f6272616e63682f6d61737465722f67726170682f62616467652e737667) ](https://codecov.io/gh/layershifter/TLDDatabase)

Abstraction layer for [Public Suffix List](https://publicsuffix.org/) in PHP. Used by [TLDExtract](https://github.com/layershifter/TLDExtract).

Main idea of library provide easy and fast access to actual database of Public Suffix List. Library always supplied with actual database.

This package is compliant with [PSR-1](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-1-basic-coding-standard.md), [PSR-2](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md), [PSR-4](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-4-autoloader.md). If you notice compliance oversights, please send a patch via pull request.

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

[](#requirements)

The following versions of PHP are supported:

- PHP 5.5
- PHP 5.6
- PHP 7.0
- PHP 7.1
- HHVM

Basic usage
-----------

[](#basic-usage)

First of all you need load Store class.

```
$store = new \LayerShifter\TLDDatabase\Store();
```

For check existence of entry in database you need use `isExists` method:

```
$store->isExists(string $suffix) : bool;

$store->isExists('com'); // true
$store->isExists('comcom'); // false
```

*Note: suffix must be without leading dot.*

For get type of suffix you need use `getType` method:

For check existence of entry in database you need use `isExists` method:

```
$store->isExists(string $suffix): int;

$store->getType('com'); // \LayerShifter\TLDDatabase\Store::TYPE_ICANN = 1
$store->getType('s3.amazonaws.com'); // \LayerShifter\TLDDatabase\Store::TYPE_PRIVATE = 2
```

If entry doesn't exists method will throw exception, else it will return one of integer constants:

- `\LayerShifter\TLDDatabase\Store::TYPE_ICANN`;
- `\LayerShifter\TLDDatabase\Store::TYPE_PRIVATE`;

For direct check of type you can use `isICANN` or `isPrivate` method.

```
$store->isICANN(string $suffix) : bool;

$store->isICANN'com'); // true
$store->isICANN('s3.amazonaws.com'); // false

$store->isPrivate(string $suffix) : bool;

$store->isPrivate('com'); // false
$store->isPrivate('s3.amazonaws.com'); // true
```

Advanced usage
--------------

[](#advanced-usage)

There are some cool features for developers.

#### Custom database

[](#custom-database)

If you need operate with custom (non-packaged) database you simply need to add argument to `Store` constructor.

```
$store = new \LayerShifter\TLDDatabase\Store(string $filename);
$store = new \LayerShifter\TLDDatabase\Store(__DIR__ . '/cache/datatabase.php');
```

#### Update

[](#update)

If you use custom database you need update it 😉 So, you can use `Update` class.

```
$update = new \LayerShifter\TLDDatabase\Update(string $filename);
$update = new \LayerShifter\TLDDatabase\Update(__DIR__ . '/cache/datatabase.php');

$update->run();
```

#### HTTP-adapter

[](#http-adapter)

Basically library uses cURL adapter for updates, but you can use custom adapter.

```
class customHttp implements \LayerShifter\TLDDatabase\Http\AdapterInterface {
    public function get() {}
}

$update = new \LayerShifter\TLDDatabase\Update(__DIR__ . '/cache/datatabase.php', 'customHttp');
$update->run();
```

Install
-------

[](#install)

Via Composer

```
$ composer require layershifter/tld-database
```

Testing
-------

[](#testing)

```
$ composer test
```

Versioning
----------

[](#versioning)

Library uses [SemVer](http://semver.org/) versioning. Where:

- major makes incompatible API changes;
- minor adds functionality, fully backwards-compatible;
- patch is update of database from Public Suffix List.

Database has every week update cycle.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) and [CONDUCT](CONDUCT.md) for details.

License
-------

[](#license)

This library is released under the Apache 2.0 license. Please see [License File](LICENSE) for more information.

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity83

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 95% 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.

###  Release Activity

Cadence

Every ~34 days

Recently: every ~355 days

Total

72

Last Release

1185d ago

Major Versions

1.0.70 → 10.712023-02-18

PHP version history (3 changes)1.0.9PHP &gt;=5.5.0

1.0.16PHP ^5.5.0 || ^7.0

1.0.70PHP ^5.5.0 || ^7.0 || ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/27d181e94772bccefd4043cbedf2b8a5c1e5429f316ae6868cee0aee073608a1?d=identicon)[juris.malinens](/maintainers/juris.malinens)

---

Top Contributors

[![layershifter](https://avatars.githubusercontent.com/u/14183168?v=4)](https://github.com/layershifter "layershifter (57 commits)")[![jmalinens](https://avatars.githubusercontent.com/u/569039?v=4)](https://github.com/jmalinens "jmalinens (2 commits)")[![cyberhicham](https://avatars.githubusercontent.com/u/10002527?v=4)](https://github.com/cyberhicham "cyberhicham (1 commits)")

---

Tags

Public Suffix ListPSLdomain databasetld database

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/inbox-tld-database/health.svg)

```
[![Health](https://phpackages.com/badges/inbox-tld-database/health.svg)](https://phpackages.com/packages/inbox-tld-database)
```

###  Alternatives

[layershifter/tld-database

Database abstraction for Public Suffix List

632.5M4](/packages/layershifter-tld-database)[doctrine/orm

Object-Relational-Mapper for PHP

10.2k285.3M6.2k](/packages/doctrine-orm)[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k115.1M102](/packages/jdorn-sql-formatter)[illuminate/database

The Illuminate Database package.

2.8k52.4M9.4k](/packages/illuminate-database)[mongodb/mongodb

MongoDB driver library

1.6k64.0M546](/packages/mongodb-mongodb)[jeremykendall/php-domain-parser

Public Suffix List and IANA Root Zone Database based Domain parsing implemented in PHP.

1.2k13.0M77](/packages/jeremykendall-php-domain-parser)

PHPackages © 2026

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