Download the PHP package danjam/gmail-matcher without Composer
On this page you can find all versions of the php package danjam/gmail-matcher. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download danjam/gmail-matcher
More information about danjam/gmail-matcher
Files in danjam/gmail-matcher
Package gmail-matcher
Short Description Library to check and match the varying formats of Gmail addresses
License MIT
Homepage https://github.com/danjam/gmail-matcher
Informations about the package gmail-matcher
gmail-matcher
TL;DR: This is a PHP 7.1+ class that can normalize and compare different formats of the same Gmail address.
Gmail address rules have some caveats:
- Dots in email addresses are disregarded (
[email protected]
is the same as[email protected]
). (Source) - Addresses are case insensitive (
[email protected]
is the same as[email protected]
) - The
gmail.com
domain is interchangeable withgooglemail.com
([email protected]
is the same as[email protected]
) (Source) - Pluses are allowed in emails (
[email protected]
)
Because of this it is very possible for a system to have multiple variations of the same Gmail address associated with different users.
This class attempts to address this by providing a match(…)
method to check variations against each other and a normalize(…)
method to retrieve a normalized version of the address. Also exposed is a method for determining if an address is a Gamil address, isGmailAddress(…)
.
Between these three methods it should be possible to check, normalize and store Gmail addresses, for example to prevent duplicate signups within a system.
Install
Via Composer