martynasbakanas/php-disposable-emails

List of disposable email domains to be used in PHP

v1.0.2 2024-09-18 10:39 UTC

This package is not auto-updated.

Last update: 2025-08-20 19:49:13 UTC


README

This package provides a method for determining whether an email address is a disposable / temporary email address.

All credit to the maintaining of the list of disposable / temporary email addresses goes to https://raw.githubusercontent.com/disposable/disposable-email-domains.

Emails are added from https://raw.githubusercontent.com/disposable/disposable-email-domains/master/domains.txt

Installation

To install via Composer:

composer require martynasbakanas/php-disposable-emails

Usage in Laravel

AppServiceProvider.php

<?php

...
use MartynasBakanas\PHPDisposableEmails\EmailCheck;

public function register(): void
{
    ...

    $this->app->singleton('email-check', function () {
        return new EmailCheck();
    });
}

public function boot(): void
{
    ...

    Validator::extend('not-disposable', function ($attribute, $value, $parameters) {
        return app('email-check')->isValid($value);
    });
}

YourController.php

public function store(Request $request)
{
    $request->validate([
        'email' => [
            'required',
            'email',
            'max:255',
            'unique:users',
            'not-disposable'
        ],
    ];

    ...
}