pavlakis/allowed-emails

An email allowed list (whitelist) checker.

1.1.0 2021-06-21 22:06 UTC

This package is auto-updated.

Last update: 2022-11-22 01:16:38 UTC


README

Build Status Mutation testing badge codecov PHPStan License: MIT

pavlakis/allowed-emails is a simple package to check allowed emails (aka whitelists) within a predefined email list, and a list of email domains.

Usage

Install the package by running:

composer require pavlakis/allowed-emails

Can instantiate the AllowedEmailList class directly or use the following two named-constructors:

  • withAllowedAliases
  • withoutAllowedAliases

The parameters required are:

  • An array of emails array<int, string> These emails will be validated.

  • An array of email domains array<int, string> These email domains will be validated.

If not using the named-constructors, the allowAlias boolean flag is also a required parameter. Setting that to true will treat an email with an alias the same way as the email without the alias e.g. it will match me+alias@example.com to me@example.com.