Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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.
- Host: GitHub
- URL: https://github.com/elliotjreed/disposable-emails-filter-php
- Owner: elliotjreed
- License: mit
- Created: 2019-03-03T22:44:10.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2024-12-05T07:34:39.000Z (23 days ago)
- Last Synced: 2024-12-06T22:43:38.035Z (22 days ago)
- Topics: email, email-validation, email-verification, hacktoberfest, php
- Language: PHP
- Homepage: https://packagist.org/packages/elliotjreed/disposable-emails-filter
- Size: 442 KB
- Stars: 29
- Watchers: 3
- Forks: 8
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: code-of-conduct.md
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