Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/elliotjreed/disposable-emails-filter-php

A PHP package for determining whether an email address is from a disposable / temporary email address provider.
https://github.com/elliotjreed/disposable-emails-filter-php

email email-validation email-verification hacktoberfest php

Last synced: 6 days ago
JSON representation

A PHP package for determining whether an email address is from a disposable / temporary email address provider.

Awesome Lists containing this project

README

        

[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg)](code_of_conduct.md)

# Disposable / Temporary Email Address Filter

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 [github.com/disposable-email-domains/disposable-email-domains](https://github.com/disposable-email-domains/disposable-email-domains).

This project and it's maintainer(s) do not discourage the use of such disposable / temporary email addresses, but simply allows for the detection of such.

## Installation

PHP 8.2 or above is required. If PHP 8.1 is required please use version 4. If PHP 7.4 to 8.0 is required please use version 3.

To install via [Composer](https://getcomposer.org/download/):

```bash
composer require elliotjreed/disposable-emails-filter
```

## Usage

### Check if the email address is in the temporary domain list

The checker / filter can either be used via a static or non-static means:

```php
isDisposable('[email protected]')) {
echo 'This is a disposable / temporary email address';
}
```

or

```php
getDomainList() as $domain) {
echo $domain . PHP_EOL;
}
```

or

```php
isDisposable($email)) {
echo 'This is a disposable / temporary email address';
}
} else {
echo 'This is not a valid email address';
}
```

Would output:

```bash
This is not a valid email address
```

You can also provide your own custom domain list in a new line separated plain-text file, for example:

```text
example.com
example.net
```

Then passing the file location into the constructor:

```php