gabrola / email-normalizer
A library that will normalize email addresses for cases when different email addresses all point towards a single email account
Installs: 45 550
Dependents: 0
Suggesters: 0
Security: 0
Stars: 17
Watchers: 4
Forks: 8
Open Issues: 3
Requires
- php: >=5.6
Requires (Dev)
- php: >=5.6
- phpunit/phpunit: 9.1.4
This package is auto-updated.
Last update: 2025-01-10 14:06:10 UTC
README
This library will normalize email addresses for cases when different email addresses all point towards a single email account.
For example user.name+whatever@gmail.com
points to username@gmail.com
.
This is useful for cases such as when you want to limit a single user using a single email account to signup using different email addresses.
Installation
composer require gabrola/email-normalizer
Usage
<?php use Gabrola\EmailNormalizer\EmailNormalizer; use Gabrola\EmailNormalizer\EmailRules; $emailNormalizer = new EmailNormalizer(new EmailRules()); $normalizedEmail = $emailNormalizer->normalize('username+whatever@gmail.com'); echo $normalizedEmail; //Returns username@gmail.com
Rule Types
- Plus Tags:
username+tag@gmail.com
normalizes asusername@gmail.com
- Hyphen Tags:
username-tag@yahoo.com
normalizes asusername@yahoo.com
- Dots:
first.last@gmail.com
normalizes asfirstlast@gmail.com
- Subdomain Addressing:
whatever@username.fastmail.com
normalizes asusername@fastmail.com
- Aliases:
username@googlemail.com
normalizes asusername@gmail.com
Providers
- Gmail
- Outlook
- Yahoo
- Fastmail
- Apple iCloud
- Yandex
- Mail.ru
- ProtonMail