voku/email-check
Validates email addresses in PHP with multiple checks (syntax, DNS/MX, disposable domains and more) to reduce bounces and fake signups. Lightweight library with simple API, suitable for signup forms, user imports, and email hygiene workflows.
Strengths:
Illuminate\Validation by adding DNS, disposable/trash domain, and typo detection—features not natively supported.Fit Gaps:
shouldQueue() for async validation).Laravel Ecosystem Synergy:
validate() method) via custom rules.EmailValidator facade).Example Integration:
use Voku\Helper\Email;
use Illuminate\Validation\Rule;
Rule::macro('validEmail', function ($field, $attribute, $fail) {
$email = request()->input($field);
$validator = new Email();
if (!$validator->isEmail($email)) {
$fail("The {$attribute} must be a valid email address.");
}
});
Usage:
$request->validate([
'email' => ['required', new \App\Rules\ValidEmail],
]);
| Risk Area | Severity | Mitigation Strategy |
|---|---|---|
| DNS Performance | High | Implement caching (Redis) for DNS/trash checks. |
| False Positives | Medium | Extend trash domain list via config. |
| Thread Blocking | Medium | Offload to Laravel Queues for async validation. |
| Dependency Bloat | Low | Minimal; only voku/email-check + caching layer. |
| Maintenance Overhead | Low | MIT license allows forks if upstream stalls. |
DNS Reliability:
Trash Domain List:
Async Validation:
Testing Coverage:
Monitoring:
log channel or a monitoring tool (e.g., Sentry).Laravel Core:
Illuminate\Validation\Rules\Email with voku/email-check.Voku\Helper\Email as a singleton for reuse.email.validated or email.invalid events for downstream processing.Additional Stack Components:
Phase 1: Syntax-Only Validation
email rule with voku/email-check for syntax validation.Phase 2: DNS Validation
'dns_check' => true).Phase 3: Async Validation
HandleEmailValidation).Phase 4: Trash Domain List
dns extension (enabled by default in most Laravel deployments).| Step | Priority | Dependencies | Effort |
|---|---|---|---|
| Install package | High | None | Low |
| Basic syntax rule | High | Laravel Validation | Low |
| Redis caching | Medium | Redis setup | Medium |
| Async queue job | Low | Queue workers, UX updates | High |
| Trash domain API | Optional | Third-party API key | Medium |
.env.email, dns_error, trash_domain).{
"email": "user@example-trash.com",
"valid": false,
"reason": "disposable_domain",
"timestamp": "2023-10-01T12:00:00Z"
}
| Failure Scenario | Impact | Mitigation |
|---|---|---|
| DNS Server Unavailable | Validation fails silently | Fallback to syntax-only validation. |
| Redis Cache Failure | Repeated DNS checks | Local file-based fallback cache. |
| Queue Worker Crash | Async validations stall | Retry logic + dead-letter queue. |
| Trash Domain List Stale | False positives/negatives | Automated API refresh (e.g., cron). |
Developer Onboarding:
EMAIL_VALIDATION.md to the project with:
config/email-validation.php).Release Strategy:
config('email-validation.enabled').Metrics to Track:
How can I help you explore Laravel packages today?