PHPackages                             arubacao/tld-checker - 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. [Mail &amp; Notifications](/categories/mail)
4. /
5. arubacao/tld-checker

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

arubacao/tld-checker
====================

Top Level Domain (TLD) validation library for PHP

1.2.292(10mo ago)721.6M↓14.3%152MITPHPPHP ^7.0|^8.0

Since Nov 25Pushed 10mo ago3 watchersCompare

[ Source](https://github.com/arubacao/tld-checker)[ Packagist](https://packagist.org/packages/arubacao/tld-checker)[ Docs](https://github.com/arubacao/tld-checker)[ RSS](/packages/arubacao-tld-checker/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (6)Dependencies (2)Versions (349)Used By (2)

Top Level Domain (TLD) validation library for PHP
=================================================

[](#top-level-domain-tld-validation-library-for-php)

[![Latest Version on Packagist](https://camo.githubusercontent.com/27612a5852bd06f2a8a8376b34dd9677a28ee7c39376eabed4f338ee27548731/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f617275626163616f2f746c642d636865636b65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/arubacao/tld-checker)[![Build Status](https://camo.githubusercontent.com/86757b6d5139160ac0c2d1ca1026b3a7b05cc13a68b752dd5314c2066f2fa2af/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f617275626163616f2f746c642d636865636b65722f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.com/arubacao/tld-checker)[![Codecov](https://camo.githubusercontent.com/a1f5951252e9925b64f4868efb6b106b5211a4d54b57997c5bd61e2ce3c094a6/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f617275626163616f2f746c642d636865636b65722e7376673f7374796c653d666c61742d737175617265)](https://codecov.io/gh/arubacao/tld-checker)[![Quality Score](https://camo.githubusercontent.com/328722b98526a5159dd91a06df7eb5d831406a32a0fe34fe89ce742250c87356/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f617275626163616f2f746c642d636865636b65722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/arubacao/tld-checker)[![Total Downloads](https://camo.githubusercontent.com/ccf335aa44b5487d3005764cf70063dbec86e1063b9b09f1646818135dee713e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f617275626163616f2f746c642d636865636b65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/arubacao/tld-checker)

This package allows **validation** of **top level domains** against the official [The DNS Root Zone](https://www.iana.org/domains/root) database from [iana.org](https://www.iana.org/).
Use this to validate e.g. **domains** or **email addresses**.

> [The DNS Root Zone](https://www.iana.org/domains/root) is the upper-most part of the DNS hierarchy, and involves delegating administrative responsibility of “top-level domains”, which are the last segment of a domain name, such as .com, .uk and .nz.

*The database is stored [locally](src/RootZoneDatabase.php) and automatically updated for new database versions.*

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

[](#installation)

Install this package via composer:

```
composer require arubacao/tld-checker
```

#### Laravel

[](#laravel)

If you would like to use `arubacao/tld-checker` with the [Laravel Validator](https://laravel.com/docs/validation/latest), you must also register the service provider:
*(only required for Laravel `=5.5` [auto-discovery](composer.json#L36) is enabled.)*

```
// config/app.php

'providers' => [
    // Other Service Providers
    Arubacao\TldChecker\TldCheckerServiceProvider::class,
],
```

Notes:

- `arubacao/tld-checker` is functional and fully [tested](https://travis-ci.com/arubacao/tld-checker) for PHP `7.0` - `8.0` &amp; Laravel `5.0` - `8.x`.

Usage
-----

[](#usage)

Check a TLD using `Validator::isTld()`:

```
use Arubacao\TldChecker\Validator;

Validator::isTld('com');        // true
Validator::isTld('CN');         // true (case insensitiv)
Validator::isTld('москва');     // true (works with internationalized domain name (IDN) | unicode)
Validator::isTld('XN--CZRS0T'); // true (works with encoded IDN | 商店)
Validator::isTld('.org');       // true (allows dot prefix)
Validator::isTld('apricot');    // false
```

Check if a string ends with a valid TLD using `Validator::endsWithTld()`:

```
use Arubacao\TldChecker\Validator;

Validator::endsWithTld('apple.com');                            // true
Validator::endsWithTld('NEWS.CN');                              // true (case insensitiv)
Validator::endsWithTld('müller.vermögensberater');              // true (works with internationalized domain name (IDN) | unicode)
Validator::endsWithTld('xn--mller-kva.xn--vermgensberater-ctb');// true (works with encoded IDN | müller.vermögensberater)
Validator::endsWithTld('farming.apricot');                      // false
```

This package extends the [Laravel Validator](https://laravel.com/docs/validation/latest) with these 2 methods:

- `is_tld`
- `ends_with_tld`

Use them as follows:

```
$request->validate([
    'tld' => 'required|is_tld',
    'email' => 'required|ends_with_tld'
]);
```

Testing
-------

[](#testing)

```
composer test
```

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

[](#contributing)

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

Credits
-------

[](#credits)

- [Christopher Lass](https://github.com/arubacao)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

60

—

FairBetter than 99% of packages

Maintenance54

Moderate activity, may be stable

Popularity54

Moderate usage in the ecosystem

Community24

Small or concentrated contributor base

Maturity88

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 77.3% 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 ~8 days

Total

348

Last Release

317d ago

PHP version history (2 changes)1.0PHP ^7.0

1.2.70PHP ^7.0|^8.0

### Community

Maintainers

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

---

Top Contributors

[![arubacao](https://avatars.githubusercontent.com/u/7462542?v=4)](https://github.com/arubacao "arubacao (647 commits)")[![StyleCIBot](https://avatars.githubusercontent.com/u/11048387?v=4)](https://github.com/StyleCIBot "StyleCIBot (183 commits)")[![szepeviktor](https://avatars.githubusercontent.com/u/952007?v=4)](https://github.com/szepeviktor "szepeviktor (2 commits)")[![tomvo](https://avatars.githubusercontent.com/u/1503385?v=4)](https://github.com/tomvo "tomvo (1 commits)")[![andrewboerema](https://avatars.githubusercontent.com/u/1569403?v=4)](https://github.com/andrewboerema "andrewboerema (1 commits)")[![Webkadabra](https://avatars.githubusercontent.com/u/1168612?v=4)](https://github.com/Webkadabra "Webkadabra (1 commits)")[![daniel-farina](https://avatars.githubusercontent.com/u/13665117?v=4)](https://github.com/daniel-farina "daniel-farina (1 commits)")[![lukaszwit](https://avatars.githubusercontent.com/u/1374694?v=4)](https://github.com/lukaszwit "lukaszwit (1 commits)")

---

Tags

domainianalaravelphptldvalidationemaildomaintldtld-checker

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/arubacao-tld-checker/health.svg)

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

###  Alternatives

[egulias/email-validator

A library for validating emails against several RFCs

11.6k691.3M307](/packages/egulias-email-validator)[dominicsayers/isemail

Checks an email address against the following RFCs: 3696, 1123, 4291, 5321, 5322

308134.4k3](/packages/dominicsayers-isemail)[erag/laravel-disposable-email

A Laravel package to detect and block disposable email addresses.

226102.4k](/packages/erag-laravel-disposable-email)[kickbox/kickbox

Official kickbox API library client for PHP

591.0M4](/packages/kickbox-kickbox)[neverbounce/neverbounce-php

This package provides convenient methods to integrate the NeverBounce API into your project.

241.1M3](/packages/neverbounce-neverbounce-php)[salaros/is-biz-mail

isBizMail tells you whether a given email address is free (gmail.com, yahoo.es, yandex.ru etc) or not

32452.6k](/packages/salaros-is-biz-mail)

PHPackages © 2026

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