Download the PHP package auvernhat/easyemailvalidator without Composer
On this page you can find all versions of the php package auvernhat/easyemailvalidator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download auvernhat/easyemailvalidator
More information about auvernhat/easyemailvalidator
Files in auvernhat/easyemailvalidator
Package easyemailvalidator
Short Description A lightweight PHP package to validate email addresses against allowed and denied domain lists.
License MIT
Informations about the package easyemailvalidator
EasyEmailValidator
A lightweight PHP package to validate email addresses against allowed and denied domain lists.
Installation
Add the package to your project with Composer:
Usage
Providers
EasyEmailValidator supports multiple providers to fetch lists of allowed or denied email domains.
A provider is a PHP class that extends the abstract class ProviderAbstract and implements two methods:
getAllowDomains(): array— returns an array of allowed domains (can be empty if not used).getDenyDomains(): array— returns an array of denied domains.
Available Providers
Several providers are included by default:
-
AmieiroProvider
Uses the public lists from amieiro/disposable-email-domains. -
AdamLovingProvider
Uses the list from Adam Loving's gist. - DisposableProvider
Uses the list from disposable/disposable-email-domains.
How to Use a Provider
You can specify the provider to use when creating the validator:
If you don't specify a provider, the default is DisposableProvider:
How to Create Your Own Provider
To add your own provider, create a new class in src/Providers/ that extends ProviderAbstract and implements the required methods:
Example: Allow Only Your Company's Emails
You can create a custom provider that only allows emails from your own company domain. For example, to only accept @mycompany.com addresses:
This is useful if you want to restrict access or registration to your own organization only.
Simple, fast, and effective for filtering disposable emails!