Skip to content

EmailValidator

A PHP library that checks whether an email address is well-formed under several email standards.

Stars
11.6k
Forks
233
Licence
MIT
Language
PHP
Last update
4 days ago
Type
Library

What it is

EmailValidator is a PHP library for checking email addresses against the email format rules in several RFC standards. You pick a validation strategy, such as a standard format check or a DNS check that looks for mail servers on the domain, and the library returns true or false. The README notes that a DNS check only shows the domain accepts email, not that the specific address exists.

  • Reject malformed addresses in a registration form using the basic RFC validation
  • Check that a domain has MX records before accepting an address, using the DNS check combined with RFC validation
  • Flag addresses that pass but raise RFC warnings, using the NoRFCWarningsValidation strategy
  • Write a custom validation rule by implementing the EmailValidation interface

Great for

  • PHP developers adding email checks to sign-up or contact forms
  • Backend teams who want format checks that go beyond a simple regex
  • Projects that need to choose between strict and lenient email rules
  • Developers who want to combine a format check with a domain DNS check

Not ideal for

  • Non-PHP projects, since the library is written for PHP and installed with Composer
  • Anyone who needs to confirm that a mailbox actually exists, because the README says the DNS check does not establish this
  • Projects running PHP versions below 8.1, which the README lists as a requirement
Step-by-step guide: how to use EmailValidatorInstall, first run, examples, tips and FAQs

How to get it

  1. 1

    Install with a package manager

    You'll need: PHP 8.1 · Composer

    Install via Composer

    composer require egulias/email-validator
  2. 2

    Run it

    • Install the library with Composer using the command above.
    • Create an EmailValidator object in your PHP code.
    • Call isValid() with an address and an RFCValidation object.
    • Check the true or false result in your application logic.
  3. 3

    Get the most out of it

    • Use MultipleValidationWithAnd to run RFC format and DNS checks together.
    • Add SpoofCheckValidation if you need to catch addresses with look-alike UTF-8 characters, and install PHP Intl first.
    • Use NoRFCWarningsValidation if you want stricter behavior that rejects addresses with RFC warnings.
    • Implement the EmailValidation interface to add rules specific to your application.

Downloads

Strengths

  • Supports several RFC standards, including internationalized address rules (RFC 6531 and 6532)
  • Lets you combine validation strategies, such as format plus DNS checks, with one class
  • Installs with a single Composer command and has a basic example in the README

Trade-offs

  • DNS and spoofing checks require the PHP Intl extension, which some hosting setups may not have
  • The README does not describe how it performs against other libraries or PHP's built-in filter_var today; it only mentions past performance work on v2 and earlier
  • Format validity does not prove an address is real or deliverable

How it compares

ProjectStarsTypeLevelUpdatedBest for
EmailValidator (this)11.6kLibrarybeginner4 days agoPHP developers adding email checks to sign-up or contact forms
validator.js23.7kLibrarybeginner2 months agoJavaScript developers validating form or API input on Node.js
guzzle23.4kLibraryintermediate11 days agoPHP developers who need to call external REST or web service APIs
monolog21.4kLibraryintermediate5 days agoPHP developers who need structured logs from an application
ajv14.9kLibraryintermediate2 months agoNode.js developers validating API request or response bodies
flysystem13.6kLibraryintermediate1 months agoPHP developers who need to store files in more than one place

Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.