Laravel Disposable Email Detection Package 2025
Er Amit Gupta

Er Amit Gupta @eramitgupta

About: Sr. Full Stack Developer - PHP, Laravel & Package Dev, Vue js, React js, Inertia js, Livewire, Alpine js, Javascript, jQuery, CSS Framework, VPS Server

Location:
Lucknow
Joined:
Sep 13, 2024

Laravel Disposable Email Detection Package 2025

Publish Date: Apr 19
0 0

Laravel Disposable Email Detection

Screenshot 2024-10-04 at 10 34 23 PM

Packagist License
Latest Stable Version
Total Downloads

A Laravel package to detect and block disposable (temporary) email addresses during validation or runtime logic.

Already contains 106,580+ disposable email domains! 🔥


🚀 Installation

composer require erag/laravel-disposable-email
Enter fullscreen mode Exit fullscreen mode

🛠 Configuration

Publish the config file:

 php artisan erag:install-disposable-email  
Enter fullscreen mode Exit fullscreen mode

This will create config/disposable-email.php.


⚙ Usage

1. Form Request Validation

✅ Custom Rule:

use EragLaravelDisposableEmail\Rules\DisposableEmailRule;

$request->validate([
    'email' => ['required', 'email', new DisposableEmailRule()],
]);
Enter fullscreen mode Exit fullscreen mode

✅ String-based Rule:

$request->validate([
    'email' => 'required|email|disposable_email',
]);
Enter fullscreen mode Exit fullscreen mode

2. Direct Runtime Check

use EragLaravelDisposableEmail\Rules\DisposableEmailRule;

if (DisposableEmailRule::isDisposable('test@tempmail.com')) {
    // Do something if email is disposable
}
Enter fullscreen mode Exit fullscreen mode

Or via facade:

use DisposableEmail;

if (DisposableEmail::isDisposable('agedmail.com')) {
    // Do something
}
Enter fullscreen mode Exit fullscreen mode

3. Blade Directive

@disposableEmail('amit@0-mail.com')
    <p class="text-red-600">Disposable email detected!</p>
@else
    <p class="text-green-600">Valid email.</p>
@enddisposableEmail
Enter fullscreen mode Exit fullscreen mode

📦 Features

  • 106,580+ known disposable domains out-of-the-box
  • Uses latest community sources
  • Supports auto-syncing from remote URLs
  • Custom validation rule
  • Facade and Blade support

🔄 Sync From Remote (Optional)

Update the list manually

php artisan erag:sync-disposable-email-list
Enter fullscreen mode Exit fullscreen mode

🔗 Config Options (config/disposable-email.php)

return [
    'blacklist_file' => storage_path('app/blacklist_file),

    'remote_url' => [
        'https://raw.githubusercontent.com/disposable/disposable-email-domains/master/domains.txt',
        'https://raw.githubusercontent.com/7c/fakefilter/refs/heads/main/txt/data.txt',
    ],
];
Enter fullscreen mode Exit fullscreen mode

Note: The .txt files from remote_url must follow this format:

Each line should contain only a domain name, like:

0-00.usa.cc
0-30-24.com
0-attorney.com
0-mail.com
00-tv.com
00.msk.ru
00.pe
00000000000.pro
000728.xyz
000777.info
00082cc.com
00082dd.com
00082ss.com
Enter fullscreen mode Exit fullscreen mode

If the file contains anything other than plain domains (like comments or extra data), it may cause parsing issues.

🧩 Add Your Own Disposable Domains

Want to block additional disposable domains?

You can easily extend the list manually — no coding, no command required!

Step Action
🔹 1 Go to the following path:
storage/app/blacklist_file/
🔹 2 Create or edit this file:
disposable_domains.txt
🔹 3 Add your custom domains like:
abakiss.com
fakemail.org
trashbox.io
(one per line)

📌 Important Notes:

  • Each line must contain only the domain name – no extra symbols, no comments.
  • The package will automatically detect and use the domains from this file.
  • You do not need to run any Artisan command. 🧙‍♂️

⚙️ Ensure File Path Matches Configuration

Your file path must match the one defined in config/disposable-email.php:

'blacklist_file' => storage_path('app/blacklist_file'),
Enter fullscreen mode Exit fullscreen mode

If the path or filename is different, the package will not load your custom list. ✅

Comments 0 total

    Add comment