raul3k/disposable-email-blocker-laravel
Composer 安装命令:
composer require raul3k/disposable-email-blocker-laravel
包简介
Laravel integration for disposable email detection
README 文档
README
Laravel integration for disposable/temporary email detection. Built on top of raul3k/disposable-email-blocker-core.
Features
- Validation Rule - Easily validate emails in forms
- Facade - Simple API for checking emails anywhere
- Database Checker - Store and manage disposable domains in your database
- Artisan Commands - Update domains from multiple sources
- Laravel Cache Integration - Redis, File, Database, or any Laravel cache driver
- Auto-discovery - Works out of the box with Laravel 11 and 12
Installation
composer require raul3k/disposable-email-blocker-laravel
The package uses Laravel's auto-discovery, so no manual service provider registration is needed.
Publish Configuration (Optional)
php artisan vendor:publish --tag=disposable-blocker-config
Publish Migrations (For Database Checker)
php artisan vendor:publish --tag=disposable-blocker-migrations php artisan migrate
Usage
Validation Rule
use Raul3k\DisposableBlocker\Laravel\Rules\NotDisposableEmail; // In a Form Request public function rules(): array { return [ 'email' => ['required', 'email', new NotDisposableEmail()], ]; } // With custom message 'email' => [new NotDisposableEmail('Temporary emails are not allowed')], // In a Controller $request->validate([ 'email' => ['required', 'email', new NotDisposableEmail()], ]);
Facade
use Raul3k\DisposableBlocker\Laravel\Facades\DisposableEmail; // Simple check if (DisposableEmail::isDisposable($email)) { return back()->withErrors(['email' => 'Disposable emails not allowed']); } // Get detailed result $result = DisposableEmail::check($email); $result->isDisposable(); // bool $result->isSafe(); // bool $result->getDomain(); // string $result->getConfidence(); // float // Check domain directly DisposableEmail::isDomainDisposable('mailinator.com'); // true // Batch checking $results = DisposableEmail::checkBatch([ 'user1@gmail.com', 'user2@mailinator.com', ]); // Domain information $info = DisposableEmail::info('user@mail.example.co.uk'); $info->domain(); // 'example.co.uk' $info->subdomain(); // 'mail' $info->publicSuffix(); // 'co.uk' $info->isPrivate(); // false
Artisan Commands
# List available sources php artisan disposable:list-sources # Update domains from all sources php artisan disposable:update # Update from a specific source php artisan disposable:update --source=mailchecker # Import from a specific source php artisan disposable:import mailchecker # Import with options php artisan disposable:import mailchecker --clear --chunk=500
Configuration
// config/disposable-blocker.php return [ // Checker type: 'file', 'database', 'pattern', 'chain' 'checker' => env('DISPOSABLE_CHECKER', 'file'), // Use bundled list from core package 'use_bundled_list' => true, // Enable pattern-based detection 'pattern_detection' => false, // Domains to whitelist (never block) 'whitelist' => [ // 'mycompany.com', ], // Cache settings 'cache' => [ 'enabled' => true, 'store' => env('DISPOSABLE_CACHE_STORE', 'default'), 'ttl' => 3600, 'prefix' => 'disposable_email:', ], // Database settings (when checker = 'database') 'database' => [ 'table' => 'disposable_domains', 'connection' => null, ], ];
Checker Types
File Checker (Default)
Uses the bundled list from the core package. Fast and requires no setup.
'checker' => 'file', 'use_bundled_list' => true,
Database Checker
Store domains in your database for custom management.
php artisan vendor:publish --tag=disposable-blocker-migrations php artisan migrate php artisan disposable:update
'checker' => 'database',
Chain Checker
Combine multiple checkers (database + bundled list).
'checker' => 'chain', 'use_bundled_list' => true,
Pattern Detection
Enable heuristic detection based on common patterns in disposable domain names.
'pattern_detection' => true,
Available Sources
The package can fetch domains from multiple sources:
| Source | Description |
|---|---|
disposable-email-domains |
Large comprehensive list (~170k domains) |
burner-email-providers |
Curated list (~4k domains) |
mailchecker |
FGRibreau's mailchecker list |
ivolo-disposable |
Ivolo's disposable domains |
fakefilter |
7c/fakefilter list |
Testing
composer test
Static Analysis
composer analyse
License
MIT License. See LICENSE for details.
raul3k/disposable-email-blocker-laravel 适用场景与选型建议
raul3k/disposable-email-blocker-laravel 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 1, 最近一次更新时间为 2026 年 02 月 27 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「email」 「validation」 「spam」 「temporary」 「laravel」 「throwaway」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 raul3k/disposable-email-blocker-laravel 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 raul3k/disposable-email-blocker-laravel 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 raul3k/disposable-email-blocker-laravel 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Simple captcha generator
reCAPTCHA library
Client library for reCAPTCHA with proxy support, a free service that protects websites from spam and abuse.
Adds request-parameter validation to the SLIM 3.x PHP framework
Extensible library for building notifications and sending them via different delivery channels.
Email+ extends Kirby's email capabilities by adding support for multiple email services using the same Kirby email API.
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 29
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-02-27