dominicsayers/isemail
Fast, standards-focused email address validation for PHP. Implements detailed RFC/SMTP rules with configurable thresholds, helpful diagnostics, and options beyond simple regex checks—useful when you need accurate, nuanced validation in Laravel or any PHP app.
Install via Composer: composer require dominicsayers/isemail. Start by validating a single email address using the simplest method: (new isEmail())->isEmail('user@example.com'); — this returns a boolean based on default strictness (RFC-compliant, but allows common real-world formats). For detailed diagnostics (e.g., warnings about deprecated syntax), call isEmail('user@example.com', true) — it returns an array with result (boolean), errors (array), and warnings (array). Check the v3.0.7 release notes for changelog context and the README for initial usage examples.
if ((new isEmail())->isEmail($request->email)) { /* proceed */ }
Rule::exists(function ($attribute, $value) {
return (new isEmail())->isEmail($value);
})->message('Invalid email format.');
isEmail() for syntactic validity.dns_get_record($domain, DNS_MX) to confirm deliverability potential.@gmail.com subaddressing with +tag). Use only for syntax validation — not for confirming address existence.true arg) tolerates minor RFC deviations (e.g., quoted local parts without quotes in some cases). Enable strict mode only if you enforce RFC-strict compliance.final — cannot extend, but you can wrap it. Add custom logic (e.g., block free email domains like @gmail.com) in your own wrapper.true) to surface warnings like 'rfc5321_domain' (DNS not mandatory per RFC, but often expected) or 'rfc5322_cfws' (whitespace handling). Log these to refine validation thresholds.use isEmail; at the top.How can I help you explore Laravel packages today?