PHPackages                             lucenarenato/laravel-email-domain-blacklist - 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. [Validation &amp; Sanitization](/categories/validation)
4. /
5. lucenarenato/laravel-email-domain-blacklist

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

lucenarenato/laravel-email-domain-blacklist
===========================================

A Laravel package for adding email domain blacklist validation rule

v1.0.1(3y ago)09MITPHPPHP ^7.2|^8.0

Since Apr 26Pushed 3y agoCompare

[ Source](https://github.com/lucenarenato/laravel-email-domain-blacklist)[ Packagist](https://packagist.org/packages/lucenarenato/laravel-email-domain-blacklist)[ RSS](/packages/lucenarenato-laravel-email-domain-blacklist/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (3)Versions (3)Used By (0)

Laravel/Lumen Email Domain Blacklist
====================================

[](#laravellumen-email-domain-blacklist)

[![Build Status](https://camo.githubusercontent.com/24ab0105508bd9fc9a063ffa594ffbf601c8d1a6c5932e92db7a687c233f8e0c/68747470733a2f2f7472617669732d63692e6f72672f4c7563656e6172656e61746f2f6c61726176656c2d656d61696c2d646f6d61696e2d626c61636b6c6973742e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/Lucenarenato/laravel-email-domain-blacklist)[![Maintainability](https://camo.githubusercontent.com/e5384c1f7ba77a2e88cea09e6f23b39f34406203bb3f28f82432b6166a8bfb13/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f31303531616464666666663433333634393033302f6d61696e7461696e6162696c697479)](https://codeclimate.com/github/Lucenarenato/laravel-email-domain-blacklist/maintainability)[![Test Coverage](https://camo.githubusercontent.com/2d65cf714c70af1d7c8f65a947b1ab23fd9a27c88ddf2146238c4e28600a8605/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f31303531616464666666663433333634393033302f746573745f636f766572616765)](https://codeclimate.com/github/Lucenarenato/laravel-email-domain-blacklist/test_coverage)[![Latest Stable Version](https://camo.githubusercontent.com/c8186a4c81618bb1abd8672cff4d072c6b2525527f762167fba67ffef032bb21/68747470733a2f2f706f7365722e707567782e6f72672f4c7563656e6172656e61746f2f6c61726176656c2d656d61696c2d646f6d61696e2d626c61636b6c6973742f762f737461626c653f666f726d61743d666c6174)](https://packagist.org/packages/Lucenarenato/laravel-email-domain-blacklist)[![Total Downloads](https://camo.githubusercontent.com/1025acc54842e3edca63f187cb84d06ec5c091b229d54ee289d37af76183123e/68747470733a2f2f706f7365722e707567782e6f72672f4c7563656e6172656e61746f2f6c61726176656c2d656d61696c2d646f6d61696e2d626c61636b6c6973742f646f776e6c6f6164733f666f726d61743d666c6174)](https://packagist.org/packages/Lucenarenato/laravel-email-domain-blacklist)[![Latest Unstable Version](https://camo.githubusercontent.com/9496b62b905421ff6a93e6175cd3050ad47581cd8857d6c4fe9965a03971d2b2/68747470733a2f2f706f7365722e707567782e6f72672f4c7563656e6172656e61746f2f6c61726176656c2d656d61696c2d646f6d61696e2d626c61636b6c6973742f762f756e737461626c653f666f726d61743d666c6174)](https://packagist.org/packages/Lucenarenato/laravel-email-domain-blacklist)[![License](https://camo.githubusercontent.com/9c91a589eff791e4ab0b11aff156ea4613390966c7c5ae0caf49eecb097ab911/68747470733a2f2f706f7365722e707567782e6f72672f4c7563656e6172656e61746f2f6c61726176656c2d656d61696c2d646f6d61696e2d626c61636b6c6973742f6c6963656e73653f666f726d61743d666c6174)](https://packagist.org/packages/Lucenarenato/laravel-email-domain-blacklist)[![Monthly Downloads](https://camo.githubusercontent.com/3046bede57bc93057170d1119766a3663a734736988cb607e04a0c191478e27e/68747470733a2f2f706f7365722e707567782e6f72672f4c7563656e6172656e61746f2f6c61726176656c2d656d61696c2d646f6d61696e2d626c61636b6c6973742f642f6d6f6e74686c793f666f726d61743d666c6174)](https://packagist.org/packages/Lucenarenato/laravel-email-domain-blacklist)[![composer.lock](https://camo.githubusercontent.com/393ddf4797cbb70ccfbeb0821727c7d7060beac59c2b50a76f1659f350525d39/68747470733a2f2f706f7365722e707567782e6f72672f4c7563656e6172656e61746f2f6c61726176656c2d656d61696c2d646f6d61696e2d626c61636b6c6973742f636f6d706f7365726c6f636b3f666f726d61743d666c6174)](https://packagist.org/packages/Lucenarenato/laravel-email-domain-blacklist)[![FOSSA Status](https://camo.githubusercontent.com/54ade537c7cb5fad933fec4a9875d76d4a16e00d0a09f75d03ed88a5fdae8cb5/68747470733a2f2f6170702e666f7373612e696f2f6170692f70726f6a656374732f6769742532426769746875622e636f6d2532464c7563656e6172656e61746f2532466c61726176656c2d656d61696c2d646f6d61696e2d626c61636b6c6973742e7376673f747970653d736869656c64)](https://app.fossa.io/projects/git%2Bgithub.com%2FLucenarenato%2Flaravel-email-domain-blacklist?ref=badge_shield)

Validate email input that it's not blacklisted for a specific domain name.

[![](https://camo.githubusercontent.com/6f91104859a42ab8d1169de605e61e7b9c5c481f6cb1ce343c78e8d220e7c78f/68747470733a2f2f692e696d6775722e636f6d2f746e306b7673352e706e67)](https://camo.githubusercontent.com/6f91104859a42ab8d1169de605e61e7b9c5c481f6cb1ce343c78e8d220e7c78f/68747470733a2f2f692e696d6775722e636f6d2f746e306b7673352e706e67)

Usage
-----

[](#usage)

Add `blacklist` to the validation rules string.

```
  public function store(Request $request) {

      $this->validate($request,
        ['email' => 'required|email|blacklist']
      );

  }
```

Installation
============

[](#installation)

Require this package with composer:

```
composer require Lucenarenato/laravel-email-domain-blacklist

```

This package uses *AutoDiscovery*.

If you are using Laravel &lt;= 5.4 manually add the Service Provider to the providers array in `config/app.php`

```
Lucenarenato\EmailDomainBlacklist\EmailDomainBlacklistServiceProvider::class,
```

Publish the package config:

```
php artisan vendor:publish --provider="Lucenarenato\EmailDomainBlacklist\EmailDomainBlacklistServiceProvider" --tag=config

```

Documentation
=============

[](#documentation)

Laravel Email Domain Blacklist is a lightweight package that extends your validation rules with `blacklist`.

You may pass a local or remote JSON file containing all the blacklisted email domains, usually disposable email services.

If you use a third-party remote list, you may also append your custom email domains.

You may update the cached list with the console command (manually or scheduled).

An auto-update option is available if you don't want to run the command and prefer to auto-update on the first validation.

The validation message translation is available in English and Spanish; feel free to PR your translation.

### Laravel validator

[](#laravel-validator)

```
public function store(Request $request) {
    $this->validate($request,
      ['email' => 'required|email|blacklist']
    );
}
```

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

[](#configuration)

### source: string|null

[](#source-stringnull)

You may specify the preferred URL or file path to update the blacklist.

Keep `null` if you don't want to use a remote source.

Default: `https://raw.githubusercontent.com/ivolo/disposable-email-domains/master/index.json`

### cache-key: string|null

[](#cache-key-stringnull)

You may change the cache key for the sourced blacklist.

Keep `null` if you want to use the default value.

### auto-update: true|false

[](#auto-update-truefalse)

Specify if it should automatically get the source when the cache is empty.

**ADVICE:** This may slow down the first request upon validation.

Default: `false`

### append: string|null

[](#append-stringnull)

You may use a string of pipe `|` separated domains list.

Keep `null` if you don't want to append custom domains.

**Example:** `example.com|example.net|foobar.com`.

Updating the blacklist with command
-----------------------------------

[](#updating-the-blacklist-with-command)

Manually updating the cached blacklist:

```
php artisan blacklist:update-email-domains

```

It's OK if you run this command after deployment and refresh it on a weekly/monthly basis.

Scheduling the cached blacklist update (example):

```
    // app/Console/Kernel.php @schedule

    // ...
    $schedule->command('blacklist:update-email-domains')
             ->monthly()
             ->sundays()
             ->at('05:00')
             ->withoutOverlapping()
             ->sendOutputTo(storage_path('logs/email-domains-blacklist.txt'));
    // ...
```

Overriding translation
----------------------

[](#overriding-translation)

Add the JSON translation key to your project core translations, which will override the package validation message.

[More info on overriding translation](https://github.com/laravel/framework/pull/20599#issue-136044259)

Testing
=======

[](#testing)

```
vendor/bin/phpunit

```

Projects using this package
===========================

[](#projects-using-this-package)

I built this package to offload some code in my application [Fimedi NET](https://www.fimedi.net), a clinical nutrition control app for dietitians and patients.

ToDo
====

[](#todo)

- Update the project lexicon to avoid the use of offensive terms.

Contributing
============

[](#contributing)

Please try to follow the psr-2 coding style guide.

Credits
=======

[](#credits)

This package was inspired [on this great post by Matt Kingshott](https://medium.com/@mattkingshott/laravel-validation-rule-block-disposable-email-blacklisted-domains-949cab9c59fe)

- [Renato Lucena](https://www.linkedin.com/in/renato-lucena-33777133/)
- [Ilya Volodarsky](https://github.com/ivolo/) for maintenance of [disposable email domains repo](https://github.com/ivolo/disposable-email-domains)
- At symbol icon made by [Gregor Cresnar](https://www.flaticon.com/authors/gregor-cresnar) from [www.flaticon.com](http://www.flaticon.com)

Package alternatives
====================

[](#package-alternatives)

- [Laravel-Email-Domain-Validation - madeITBelgium](https://github.com/madeITBelgium/Laravel-Email-Domain-Validation)
- [Laravel Email Domain Validation - jonathanjanssens](https://github.com/jonathanjanssens/laravel-validate-email-domain)

License
=======

[](#license)

[MIT](https://opensource.org/licenses/MIT)

[![FOSSA Status](https://camo.githubusercontent.com/f5c72fcc6a99bf16b3dcf04ad1bddddd52177e50df1863a2aa8f96dfb58cd206/68747470733a2f2f6170702e666f7373612e696f2f6170692f70726f6a656374732f6769742532426769746875622e636f6d2532464c7563656e6172656e61746f2532466c61726176656c2d656d61696c2d646f6d61696e2d626c61636b6c6973742e7376673f747970653d6c61726765)](https://app.fossa.io/projects/git%2Bgithub.com%2FLucenarenato%2Flaravel-email-domain-blacklist?ref=badge_large)

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 78.2% 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 ~0 days

Total

2

Last Release

1112d ago

### Community

Maintainers

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

---

Top Contributors

[![alariva](https://avatars.githubusercontent.com/u/3021314?v=4)](https://github.com/alariva "alariva (43 commits)")[![lucenarenato](https://avatars.githubusercontent.com/u/38870097?v=4)](https://github.com/lucenarenato "lucenarenato (5 commits)")[![fossabot](https://avatars.githubusercontent.com/u/29791463?v=4)](https://github.com/fossabot "fossabot (1 commits)")[![kyranb](https://avatars.githubusercontent.com/u/5426926?v=4)](https://github.com/kyranb "kyranb (1 commits)")[![laravel-shift](https://avatars.githubusercontent.com/u/15991828?v=4)](https://github.com/laravel-shift "laravel-shift (1 commits)")[![lempa](https://avatars.githubusercontent.com/u/929798?v=4)](https://github.com/lempa "lempa (1 commits)")[![nonovd](https://avatars.githubusercontent.com/u/12936673?v=4)](https://github.com/nonovd "nonovd (1 commits)")[![sky93](https://avatars.githubusercontent.com/u/8404511?v=4)](https://github.com/sky93 "sky93 (1 commits)")[![devstack-be](https://avatars.githubusercontent.com/u/20860547?v=4)](https://github.com/devstack-be "devstack-be (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/lucenarenato-laravel-email-domain-blacklist/health.svg)

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

###  Alternatives

[spatie/laravel-honeypot

Preventing spam submitted through forms

1.6k6.0M60](/packages/spatie-laravel-honeypot)[proengsoft/laravel-jsvalidation

Validate forms transparently with Javascript reusing your Laravel Validation Rules, Messages, and FormRequest

1.1k2.3M49](/packages/proengsoft-laravel-jsvalidation)[stevebauman/purify

An HTML Purifier / Sanitizer for Laravel

5325.6M19](/packages/stevebauman-purify)[axlon/laravel-postal-code-validation

Worldwide postal code validation for Laravel and Lumen

3853.3M1](/packages/axlon-laravel-postal-code-validation)[sunspikes/clamav-validator

Custom Laravel 5 anti-virus validator for file uploads.

3651.8M3](/packages/sunspikes-clamav-validator)[laravel-validation-rules/credit-card

Validate credit card number, expiration date, cvc

2412.2M5](/packages/laravel-validation-rules-credit-card)

PHPackages © 2026

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