
A Laravel package to detect and block disposable (temporary) email addresses during validation or runtime logic.
Already contains 106,580+ disposable email domains! π₯
- π₯ 106,000+ known disposable domains already included
- π§ Smart validation rule for form requests
- βοΈ Runtime email checking via helper and facade
- π§© Blade directive support for conditionals
- π Auto-sync with remote domain lists
- π Add your own custom blacklist with ease
- β‘οΈ Zero-configuration setup with publishable config
- β Compatible with Laravel 8, 9, 10, 11, and 12
composer require erag/laravel-disposable-email
Ensure the service provider is registered in your /bootstrap/providers.php
file:
use EragLaravelDisposableEmail\LaravelDisposableEmailServiceProvider;
return [
// ...
LaravelDisposableEmailServiceProvider::class,
];
Ensure the service provider is registered in your config/app.php
file:
'providers' => [
// ...
EragLaravelDisposableEmail\LaravelDisposableEmailServiceProvider::class,
],
Publish the config file:
php artisan erag:install-disposable-email
This will create config/disposable-email.php
.
use EragLaravelDisposableEmail\Rules\DisposableEmailRule;
$request->validate([
'email' => ['required', 'email', new DisposableEmailRule()],
]);
$request->validate([
'email' => 'required|email|disposable_email',
]);
$request->validate([
'email' => ['required', 'email', 'disposable_email'],
]);
use EragLaravelDisposableEmail\Rules\DisposableEmailRule;
if (DisposableEmailRule::isDisposable('test@tempmail.com')) {
// Do something if email is disposable
}
Or via facade:
use DisposableEmail;
if (DisposableEmail::isDisposable('agedmail.com')) {
// Do something
}
@disposableEmail('amit@0-mail.com')
<p class="text-red-600">Disposable email detected!</p>
@else
<p class="text-green-600">Valid email.</p>
@enddisposableEmail
Update the list manually
php artisan erag:sync-disposable-email-list
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',
],
];
β Note: The
.txt
files fromremote_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
If the file contains anything other than plain domains (like comments or extra data), it may cause parsing issues.
β 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. π§ββοΈ
Your file path must match the one defined in config/disposable-email.php
:
'blacklist_file' => storage_path('app/blacklist_file'),
If the path or filename is different, the package will not load your custom list. β