PHPackages                             fedek6/tld-mail-validator - 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. fedek6/tld-mail-validator

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

fedek6/tld-mail-validator
=========================

PHP e-mail address validator using list of all known TLDs

1.0.3(5y ago)111Apache-2.0PHPPHP &gt;=7.4

Since Mar 17Pushed 4y ago1 watchersCompare

[ Source](https://github.com/fedek6/tld-mail-validator)[ Packagist](https://packagist.org/packages/fedek6/tld-mail-validator)[ RSS](/packages/fedek6-tld-mail-validator/feed)WikiDiscussions main Synced 4w ago

READMEChangelog (4)Dependencies (1)Versions (5)Used By (0)

TLD e-mail validator
====================

[](#tld-e-mail-validator)

[![Build Status](https://camo.githubusercontent.com/b25c32c21fa12c255c4e847919a52a7583d51ae5b62eadf1fc4838cc5e9f78b9/68747470733a2f2f7472617669732d63692e636f6d2f666564656b362f746c642d6d61696c2d76616c696461746f722e7376673f746f6b656e3d4670617079324d587172777466734c6766546870266272616e63683d6d61696e)](https://travis-ci.com/fedek6/tld-mail-validator)

PHP e-mail address validator using list of all known [TLDs](https://data.iana.org/TLD/tlds-alpha-by-domain.txt) and simple domain MX record check. With ability to automatically update top-level domains list.

Usage example
-------------

[](#usage-example)

```
use Fedek6\TldMailValidator\TldMailValidator;

/** @var string $tldsFilePath  */
$tldsFilePath = __DIR__ . '/../data/tlds-alpha-by-domain.txt';

/** @var array $addresses */
$addresses = require __DIR__ . '/addresses.php';

/** @var \Fedek6\TldMailValidator\TldMailValidator $validator */
$validator = new TldMailValidator($tldsFilePath);

if ($validator->validate('janbrzechwa@mail.ru')) {
    echo 'This is email is OK. and has proper actual tld.';
} else {
    echo 'Something\'s wrong with this address';
}
```

If you want to test also MX record of a domain (slower), pass second argument to the constructor:

```
/** @var \Fedek6\TldMailValidator\TldMailValidator $validator */
$validator = new TldMailValidator($tldsFilePath, TldMailValidator::TEST_ALL);
```

Testing
-------

[](#testing)

```
composer test
```

Or:

```
./vendor/bin/phpunit --testdox --verbose --colors tests
```

### Test one file

[](#test-one-file)

```
vendor/bin/phpunit --testdox --verbose --colors tests/RemoteFileUpdaterTest.php
```

### Dry run before deploy

[](#dry-run-before-deploy)

```
php -f examples/mx.php
php -f examples/simple.php
```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~1 days

Total

4

Last Release

1874d ago

PHP version history (2 changes)1.0.0PHP &gt;=7.4.0

1.0.2PHP &gt;=7.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/744ff44ac8628f1078924bc524f75600dcd5ac85413a1c902931cca571e46b26?d=identicon)[fedek6](/maintainers/fedek6)

---

Top Contributors

[![fedek6](https://avatars.githubusercontent.com/u/6105281?v=4)](https://github.com/fedek6 "fedek6 (1 commits)")

---

Tags

mailmail-validationphptldvalidator

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/fedek6-tld-mail-validator/health.svg)

```
[![Health](https://phpackages.com/badges/fedek6-tld-mail-validator/health.svg)](https://phpackages.com/packages/fedek6-tld-mail-validator)
```

###  Alternatives

[tijsverkoyen/css-to-inline-styles

CssToInlineStyles is a class that enables you to convert HTML-pages/files into HTML-pages/files with inline styles. This is very useful when you're sending emails.

5.8k505.3M228](/packages/tijsverkoyen-css-to-inline-styles)[minishlink/web-push

Web Push library for PHP

1.9k12.0M52](/packages/minishlink-web-push)[laravel-notification-channels/twilio

Provides Twilio notification channel for Laravel

2587.7M12](/packages/laravel-notification-channels-twilio)[spatie/url-signer

Generate a url with an expiration date and signature to prevent unauthorized access

4422.3M16](/packages/spatie-url-signer)[mattketmo/email-checker

Throwaway email detection library

2742.0M5](/packages/mattketmo-email-checker)[laravel-notification-channels/discord

Laravel notification driver for Discord.

2371.3M11](/packages/laravel-notification-channels-discord)

PHPackages © 2026

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