romanzipp/laravel-mailcheck
Composer 安装命令:
composer require romanzipp/laravel-mailcheck
包简介
A Laravel Wrapper for the MailCheck.ai disposable email API
README 文档
README
A Laravel Wrapper for the MailCheck.ai disposable email API made by @tompec.
✨ Migrating from Validator.Pizza
This package was previously called "Validator.Pizza". See the following guide if you want to migrate your previous installation.
Migration Guide
Package name
composer remove romanzipp/laravel-validator-pizza composer require romanzipp/laravel-mailcheck
Config file
Update the configuration file name.
- config/mailcheck.php + config/mailcheck.php
Code references
- romanzipp\ValidatorPizza\ + romanzipp\MailCheck\
Rule
- 'email' => 'required|email|validator_pizza', + 'email' => 'required|email|disposable',
Table name
The default new table name will be mailcheck_checks. If you want to keep the previous validator_pizza table name change the entry in your config file.
- validator_pizza + mailcheck_checks
Features
- Query the MailCheck.ai API for disposable Emails & Domains
- Cache responses
- Store requested domains in database
Installation
composer require romanzipp/laravel-mailcheck
Configuration
Copy configuration to your project:
php artisan vendor:publish --provider="romanzipp\MailCheck\Providers\MailCheckProvider"
Run the migration:
php artisan migrate
Usage
Controller Validation
namespace App\Http\Controllers; use Illuminate\Http\Request; class HomeController extends Controller { public function handleEmail(Request $request) { $request->validate([ 'email' => 'required|email|disposable', ]); // ... } }
Standalone
$checker = new \romanzipp\MailCheck\Checker; // Validate domain $validDomain = $checker->allowedDomain('ich.wtf'); // Validate mail address (uses domain check endpoint internally) $validEmail = $checker->allowedEmail('ich@ich.wtf');
Advanced Usage
You can make your disposable checks more hard or loose by configuring the edge case behavior. There are 3 possible outcomes to set:
romanzipp\MailCheck\Enums\ApiIssue::ALLOW- allow the domain/mailromanzipp\MailCheck\Enums\ApiIssue::DENY- deny the chekechecked domain/mailromanzipp\MailCheck\Enums\ApiIssue::EXCEPTION- throw aDisposableMailException
Rate Limit exceeded
return [ // ... 'decision_rate_limit' => \romanzipp\MailCheck\Enums\ApiIssue::EXCEPTION, ];
No MX DNS records present
There is no MX DNS entry present on the checked domain which means they can not receive any messages.
return [ // ... 'decision_no_mx' => \romanzipp\MailCheck\Enums\ApiIssue::EXCEPTION, ];
Invalid request
return [ // ... 'decision_invalid' => \romanzipp\MailCheck\Enums\ApiIssue::EXCEPTION, ];
romanzipp/laravel-mailcheck 适用场景与选型建议
romanzipp/laravel-mailcheck 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 5.46k 次下载、GitHub Stars 达 5, 最近一次更新时间为 2023 年 09 月 25 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 romanzipp/laravel-mailcheck 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 romanzipp/laravel-mailcheck 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 5.46k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 10
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-09-25