GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - nojacko/email-validator: Small PHP library to valid email addresses using a number of methods.

This repository was archived by the owner on May 12, 2026. It is now read-only.
BranchesTags
Open more actions menu

Latest commit

 

History

36 Commits
36 Commits

Folders and files

NameName
Last commit message
Last commit date
src
src
 
 
tests
tests
 
 
.gitignore
.gitignore
 
 
.travis.yml
.travis.yml
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
composer.json
composer.json
 
 
composer.lock
composer.lock
 
 
phpunit.xml
phpunit.xml
 
 

Repository files navigation

Email Validator

Small PHP library to valid email addresses using a number of methods.

License Build Status Code Quality Downloads Github Stars

Features

  • Validates email address
  • Checks for example domains (e.g. example.com)
  • Checks for disposable email domains (e.g. mailinator.com)
  • Checks for role-based addresses (e.g. abuse@)
  • Checks for MX records (i.e. can receive email)

Install (using Composer)

composer require nojacko/email-validator:~1.0

Usage

Generalised Functions

  • isValid($email) Runs all the tests within this library. Returns true or false.
  • isSendable($email) Checks isEmail, isExample and hasMx. Returns true or false.

Specific Functions

If you want more control, use these functions seperately.

  • isEmail($email) Note: returns true or false only.
  • isExample($email)
  • isDisposable($email)
  • isRole($email)
  • hasMx($email)

These functions take a single argument (an email address) and return:

  • true, when function name is satisfied.
  • false, when function name is not satisfied.
  • null, when check is not possible, i.e. an invalid email is given.

Examples

$validator = new \EmailValidator\Validator();

$validator->isValid('[email protected]');              // true
$validator->isValid('[email protected]');                // false
$validator->isValid('[email protected]');             // false

$validator->isSendable('[email protected]');           // true
$validator->isSendable('[email protected]');             // true
$validator->isSendable('[email protected]');          // false

$validator->isEmail('[email protected]');             // true
$validator->isEmail('example@example');                 // false

$validator->isExample('[email protected]');           // true
$validator->isExample('[email protected]');            // false
$validator->isExample('example.com');                   // null

$validator->isDisposable('[email protected]');        // false
$validator->isDisposable('[email protected]');     // true
$validator->isDisposable('example.com');                // null

$validator->isRole('[email protected]');              // false
$validator->isRole('[email protected]');                // true
$validator->isRole('example.com');                      // null

$validator->hasMx('[email protected]');               // false
$validator->hasMx('[email protected]');                // true
$validator->hasMx('example.com');                       // null

Contribute

Contributions welcome!

Requirements

  • Test-driven development
  • Follow PSR-2 Coding Style Guide
  • One change per pull request

Add/Remove Disposable Domain

See the email-data-disposable project.

New Feature

If you're planning a new feature, please raise an issue first to ensure it's in scope. The aim is to keep this library small and with one specific purpose.

Other Contributions

For anything that isn't a new feature (bug fix, tests, etc) just create a pull request.

Testing

Test are all located in tests folder.

Run tests with phpunit. In root folder, execute phpunit in a CLI.

Versioning

Semantic Versioning 2.0.0

License

The MIT License (MIT). See LICENCE file.

About

Small PHP library to valid email addresses using a number of methods.

github.com/nojacko/email-validator

Resources

Readme
MIT license
Activity

Stars

163 stars

Watchers

1 watching

Forks

20 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.