lukaswhite / email-checker
A PHP package that checks e-mail addresses to see if they're disposable, or from a provider of free addresses
Installs: 84
Dependents: 2
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Type:project
Requires
- czproject/git-php: ^4.0
Requires (Dev)
- phpunit/php-code-coverage: ^9.2
- phpunit/phpunit: ^9.5
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.