lukaswhite/email-checker

A PHP package that checks e-mail addresses to see if they're disposable, or from a provider of free addresses

1.0.0 2022-08-05 09:32 UTC

This package is auto-updated.

Last update: 2024-04-05 13:45:42 UTC


README

A library for checking an e-mail address to see if it's from a provider of free or disposable providers.

It's essentially a PHP wrapper around the data provided by the freemail project, with a straightforward way to keep the data up-to-date.

Usage

First, you need to grab the data:

$sync = new \Lukaswhite\EmailChecker\Data\Sync('./some/local/path');
$sync->fetch();

Then you're good to go:

$checker = new \Lukaswhite\EmailChecker\Checker();

$result = $checker->check('hello@mailinator.com');

$result->isDisposable(); // true
$result->isFree(); // false
$result->isBlacklisted(); // false

To update the data; for example, via a cron job:

$sync = new \Lukaswhite\EmailChecker\Data\Sync('./some/local/path');
$sync->update();

Under the Hood

The package works by fetching the freemail package using Git into a local folder, then looking up an email's domain from that data.

Running the update method simply pulls in any changes from the remote Git repository.