Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Isemail Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Getting Started

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.

Implementation Patterns

  • Inline validation in forms: Use in Laravel FormRequests or controllers to validate email fields before persisting or sending. Example:
    if ((new isEmail())->isEmail($request->email)) { /* proceed */ }
    
  • Custom validation rule: Wrap it in a Laravel custom rule for reuse:
    Rule::exists(function ($attribute, $value) {
        return (new isEmail())->isEmail($value);
    })->message('Invalid email format.');
    
  • Progressive validation: Combine with DNS/MX record checks:
    1. Use isEmail() for syntactic validity.
    2. If valid, run dns_get_record($domain, DNS_MX) to confirm deliverability potential.
  • Bulk processing: Use in console commands or jobs to validate email lists (e.g., user import), logging warnings/errors for auditing.

Gotchas and Tips

  • ⚠️ Stale but reliable: Last release in 2016; though RFC validation is stable, it may not reflect new TLDs or email provider quirks (e.g., @gmail.com subaddressing with +tag). Use only for syntax validation — not for confirming address existence.
  • ⚠️ Strict vs. lenient mode: Default behavior (without the second 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.
  • 🛠️ Extensibility: The class is final — cannot extend, but you can wrap it. Add custom logic (e.g., block free email domains like @gmail.com) in your own wrapper.
  • 🔧 Debugging failed emails: Use verbose mode (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.
  • 📦 Composer autoloading: Works out of the box — no Laravel service provider or config needed. Just use isEmail; at the top.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport