Validate user-submitted email addresses on a PHP registration or contact form before storing or sending to them.
Run DNS validation to confirm the email domain has real mail server records before adding an address to a mailing list.
Combine RFC syntax checking, DNS verification, and spoof detection in one pass using MultipleValidationWithAnd.
Write a custom validation strategy implementing EmailValidation to enforce proprietary business rules like blocking disposable domains.
DNS and spoof checks require the PHP intl extension, otherwise a composer require is all that's needed to start validating.
EmailValidator is a PHP library for checking whether an email address is valid. Validating email addresses is a common need in PHP applications: registration forms, contact forms, and mailing list sign-ups all benefit from knowing whether the address a user typed is properly formed before attempting to send to it. This library handles that job with a set of independent validation strategies you can pick from and combine. The core strategy is RFC validation, which checks that an address follows the format rules defined in the email standards (RFC 5321, 5322, 6530, 6531, and 6532). These RFCs are the technical specifications that define how email addresses are supposed to be structured. A stricter variant called NoRFCWarningsValidation treats even minor deviations from those standards as failures rather than just warnings. A DNS check validation queries the internet to confirm there are actual mail server records for the address domain, which tells you the domain can receive mail, though it does not confirm the specific address exists. A spoof check looks for mixed Unicode characters that could be used to make one email address look visually like another. All of these strategies can be combined using the MultipleValidationWithAnd class, which runs each check in sequence and only returns valid if every one passes. You can also write your own validation by implementing the EmailValidation interface the library provides. Installation uses Composer, the standard PHP dependency manager. The DNS and spoof checks require the PHP internationalization extension (intl) to be installed on your server. The library is released under the MIT license.
← egulias on gitmyhub — every repo by this author, as a profile.
Verify against the repo before relying on details.