Are you tired of spam or temporary emails like tempmail.com
, 10minutemail.com
, or mailinator.com
messing up your Laravel application?
Let me introduce you to laravel-disposable-email β a lightweight yet powerful Laravel package that detects and blocks disposable email addresses using validation rules, runtime checks, Blade directives, and more.
β Already includes over 106,000+ disposable email domains β updated regularly!
π Why Block Disposable Emails in Laravel?
Disposable or temporary email services are used to:
- Bypass email verification
- Spam your app with fake signups
- Skew analytics and user data
- Abuse trial-based services or coupons
By using this package, you can keep your user base clean and your analytics real.
βοΈ Key Features
- β 106,000+ disposable email domains included
- π§ Smart validation rule (
new DisposableEmailRule()
) - π§© Blade directive:
@disposableEmail(...)
- π‘ Runtime check using helper or facade
- β‘ Optional cache support for high-performance
- π Auto-sync with open-source blocklists
- π§ Add your own custom domains without coding
- π Laravel 10, 11, and 12 support
π Installation
composer require erag/laravel-disposable-email
Then publish the config and domain file:
php artisan erag:install-disposable-email
β How to Use in Laravel
π 1. Validate in Form Requests
Object Rule:
use EragLaravelDisposableEmail\Rules\DisposableEmailRule;
$request->validate([
'email' => ['required', 'email', new DisposableEmailRule()],
]);
String Rule:
$request->validate([
'email' => 'required|email|disposable_email',
]);
β‘ 2. Runtime Check
use DisposableEmail;
if (DisposableEmail::isDisposable('test@10minutemail.com')) {
// Block or log user
}
π§© 3. Blade Directive
@disposableEmail('fake@mailinator.com')
<p class="text-red-600">Disposable email detected!</p>
@else
<p class="text-green-600">Looks good!</p>
@enddisposableEmail
π Sync Disposable Domains
This package fetches updated disposable domain lists from trusted open-source sources like:
Update list manually with:
php artisan erag:sync-disposable-email-list
π§ Add Your Own Domains (Custom Blacklist)
Just add domain names (one per line) to:
storage/app/blacklist_file/disposable_domains.txt
Example:
fakemail.org
trashbox.io
noemail.net
No commands needed β the package automatically reads them.
β‘ Enable Caching (Recommended for Performance)
In config/disposable-email.php
, set:
'cache_enabled' => true,
'cache_ttl' => 60, // minutes
Clear cache if needed:
php artisan cache:clear
π» Compatible With Laravel 10, 11, 12
Whether youβre using Laravel 10, 11, or 12, this package works flawlessly.
π GitHub & Packagist
- π GitHub: eramitgupta/laravel-disposable-email
- π¦ Packagist: erag/laravel-disposable-email
π Conclusion
If you're serious about stopping fake signups, improving user data quality, and securing your Laravel app, laravel-disposable-email
is a must-have.
Itβs simple, powerful, and ready to use in minutes. Install today and protect your application like a pro.
π’ Share this with your Laravel community
If you found this useful, give it a β on GitHub and share the package with your dev team or community. Every spam-free app makes the web better!
Top comments (0)