PHPackages                             silassiai/laravel-email-validation - 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. silassiai/laravel-email-validation

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

silassiai/laravel-email-validation
==================================

Validate your email with this email validation package on email filter, typos. dns and spoofing.

v2.0.0(2d ago)13.5k2MITPHPPHP ^8.2CI passing

Since Sep 2Pushed 2d ago1 watchersCompare

[ Source](https://github.com/Silassiai/laravel-email-validation)[ Packagist](https://packagist.org/packages/silassiai/laravel-email-validation)[ RSS](/packages/silassiai-laravel-email-validation/feed)WikiDiscussions main Synced yesterday

READMEChangelog (6)Dependencies (13)Versions (12)Used By (0)

Laravel Email Validation
========================

[](#laravel-email-validation)

[![Tests](https://github.com/Silassiai/laravel-email-validation/actions/workflows/run-tests.yml/badge.svg)](https://github.com/Silassiai/laravel-email-validation/actions/workflows/run-tests.yml)[![Latest Version on Packagist](https://camo.githubusercontent.com/6fcf5b13a8762b04223fff59e61b1386deeae369619cbd87dba87ddb09c9f190/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f73696c6173736961692f6c61726176656c2d656d61696c2d76616c69646174696f6e2e737667)](https://packagist.org/packages/silassiai/laravel-email-validation)[![Total Downloads](https://camo.githubusercontent.com/7cfa9c1d29edab803d3f81ddd7c6ed3c337fe54e4027d01b27b33e865ad544d0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73696c6173736961692f6c61726176656c2d656d61696c2d76616c69646174696f6e2e737667)](https://packagist.org/packages/silassiai/laravel-email-validation)[![License](https://camo.githubusercontent.com/f05adee2820b5813dbab7ed08e33c2e63ae0c5efbb5b58ac3bec4e0c14d0547e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f73696c6173736961692f6c61726176656c2d656d61696c2d76616c69646174696f6e2e737667)](LICENSE)

Catch email domain typos before they end up in your database.

When a user signs up with `silas@gmial.com`, they almost certainly meant `silas@gmail.com` — and every mail you send to the typoed address will bounce. This package detects typos in the domain part of an email address by comparing it against a list of known mail providers, and suggests the domain the user most likely meant. Perfect for a *"Did you mean ?"* prompt on your registration or checkout form.

Features
--------

[](#features)

- **Typo detection** — detects swapped, missing or extra characters in mail provider domains (`gmial.com`, `hotmal.com`, `gmaill.com`, …) and returns the most likely intended domain.
- **Domain validation** — check whether an email uses a known mail provider domain.
- **False-positive protection** — real providers that *look* like typos of bigger ones (e.g. `ymail.com`, `mailbox.org`) are listed as "excluded" domains, so they are recognized as valid and never flagged.
- **Zero setup, fast** — the provider lists ship with the package as plain PHP arrays. No database, no cache, no seeding; validating millions of addresses is pure in-memory work.
- **Extendable** — add your own provider domains through a config file.

Planned for future versions: DNS record validation and spoofing checks.

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

[](#requirements)

DependencySupported versionsPHP8.2 – 8.4Laravel12.x, 13.xOnly [actively supported Laravel versions](https://laravel.com/docs/releases#support-policy) are supported. No database or cache is needed: the provider lists ship with the package.

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

[](#installation)

Install the package via composer:

```
composer require silassiai/laravel-email-validation
```

The service provider is auto-discovered by Laravel, so there is nothing to register manually — you can start validating right away. Updates to the built-in provider lists arrive automatically with `composer update`.

Configuration
-------------

[](#configuration)

Want to validate against your own provider domains as well? Publish the config file:

```
php artisan vendor:publish --tag=email-validation-config
```

Then add your domains in `config/email-validation.php`. They are merged with the built-in lists:

```
return [
    // Checked for typos, just like the built-in providers
    'additional_popular' => [
        'snelmail' => ['nl'],
    ],

    // Recognized as valid, but never reported as a typo of another provider
    'additional_excluded' => [
        'mijnbedrijf' => ['nl'],
    ],
];
```

Usage
-----

[](#usage)

### Typo validation

[](#typo-validation)

`hasTypo()` returns the domain the user probably meant, or `null` when no typo was found:

```
use Silassiai\LaravelEmailValidation\Facades\EmailValidationFacade;

EmailValidationFacade::for('silas@gmial.com')->hasTypo();   // 'gmail.com'
EmailValidationFacade::for('silas@hotmal.nl')->hasTypo();   // 'hotmail.nl'
EmailValidationFacade::for('silas@gmail.com')->hasTypo();   // null (valid address)
EmailValidationFacade::for('silas@mycompany.com')->hasTypo(); // null (unknown domain, no suggestion)
```

When the domain name matches a provider but the extension isn't in the provider's list of known extensions, only the domain name is returned:

```
EmailValidationFacade::for('silas@gmial.xyz')->hasTypo();   // 'gmail'
```

A typical *"did you mean"* flow in a controller:

```
if ($suggestion = EmailValidationFacade::for($request->email)->hasTypo()) {
    $localPart = Str::before($request->email, '@');

    return back()->withInput()->with(
        'email_suggestion',
        "Did you mean {$localPart}@{$suggestion}?"
    );
}
```

### Domain validation

[](#domain-validation)

`hasValidDomain()` checks whether the domain name belongs to a known mail provider:

```
EmailValidationFacade::for('silas@gmail.com')->hasValidDomain();     // true
EmailValidationFacade::for('silas@mycompany.com')->hasValidDomain(); // false
```

How it works
------------

[](#how-it-works)

The package ships with two curated domain lists (see `Silassiai\LaravelEmailValidation\Data\MailProviderDomains`):

- **Popular domains** — well-known providers such as `gmail`, `hotmail`, `yahoo` and `outlook`. Incoming email domains are compared against these to find typos.
- **Excluded domains** — real, valid providers such as `ymail` and `mailbox` that closely resemble a popular domain. These are recognized as valid and are never reported as a typo of another provider.

The domain part of the email is parsed from the right: the extension is the last label — or the last two labels for known two-label suffixes such as `co.uk` and `com.au` — and the domain name is the label directly in front of it. Subdomains are ignored, so `silas@mail.mycompany.nl` is treated as domain name `mycompany` with extension `nl` and does not collide with the `mail` provider.

The two-label suffixes are a curated subset of the [Public Suffix List](https://publicsuffix.org/list/public_suffix_list.dat), covering the countries where the built-in providers operate (see `SECOND_LEVEL_SUFFIXES` in `Silassiai\LaravelEmailValidation\Validation\Email`). The full list — thousands of entries, including internationalized suffixes — is intentionally not bundled: for a suffix that is not in the subset (say `com.gy`), the parser falls back to treating the last label as the extension. That misparse is harmless: the resulting domain name (`com`, `net`, `org`, …) never matches or resembles a provider, so no false typo is ever reported — at worst a typo in such a domain goes undetected.

For the typo check itself, the domain name is compared against each popular provider using:

1. a **length check** — a difference of more than one character is never considered a typo;
2. a **character frequency comparison** — at most 1 character may differ, or 2 for domain names longer than six characters;
3. a **first-characters check** — real typos rarely start completely differently, so at least part of the first three characters must line up.

Testing
-------

[](#testing)

```
composer test         # run the PHPUnit test suite
composer analyse      # run PHPStan static analysis (level: max)
composer format       # fix code style with Laravel Pint
composer format:test  # check code style without fixing
```

The test suite runs against PHP 8.2 – 8.4 and Laravel 12 – 13 on every push via GitHub Actions, along with PHPStan at the maximum level and a Pint code style check.

Upgrading
---------

[](#upgrading)

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

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Credits
-------

[](#credits)

- [Silas de Rooy](https://github.com/Silassiai)

License
-------

[](#license)

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

###  Health Score

51

—

FairBetter than 95% of packages

Maintenance99

Actively maintained with recent releases

Popularity24

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 73% 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 ~133 days

Recently: every ~167 days

Total

6

Last Release

2d ago

Major Versions

v1.2.0 → v2.0.02026-07-02

PHP version history (2 changes)v1.0.0PHP ^8

v1.1.0PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/5eeafc88159e5a5c12b2ddeb4935445a56fdaf1f7fbcbbb89d678d9c9a93b297?d=identicon)[Silassiai](/maintainers/Silassiai)

---

Top Contributors

[![silas-oss](https://avatars.githubusercontent.com/u/229648012?v=4)](https://github.com/silas-oss "silas-oss (27 commits)")[![Silassiai](https://avatars.githubusercontent.com/u/18419961?v=4)](https://github.com/Silassiai "Silassiai (9 commits)")[![v-tkachenko-dev](https://avatars.githubusercontent.com/u/22010906?v=4)](https://github.com/v-tkachenko-dev "v-tkachenko-dev (1 commits)")

---

Tags

laravelvalidationpackageemailemailvalidationemail validatorsilassiaiemail-validaton

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/silassiai-laravel-email-validation/health.svg)

```
[![Health](https://phpackages.com/badges/silassiai-laravel-email-validation/health.svg)](https://phpackages.com/packages/silassiai-laravel-email-validation)
```

###  Alternatives

[laravel/ai

The official AI SDK for Laravel.

1.0k3.2M200](/packages/laravel-ai)[larastan/larastan

Larastan - Discover bugs in your code without running it. A phpstan/phpstan extension for Laravel

6.5k55.4M8.5k](/packages/larastan-larastan)[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[propaganistas/laravel-disposable-email

Disposable email validator

6023.0M7](/packages/propaganistas-laravel-disposable-email)[laravel/cashier

Laravel Cashier provides an expressive, fluent interface to Stripe's subscription billing services.

2.6k29.9M147](/packages/laravel-cashier)[illuminate/queue

The Illuminate Queue package.

21332.6M1.6k](/packages/illuminate-queue)

PHPackages © 2026

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