PHPackages                             rezozero/canonical-email - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. rezozero/canonical-email

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

rezozero/canonical-email
========================

Simple PHP library to canonize emails address from gmail.com or other providers that allow several forms of email.

1.1.0(1y ago)1162.0k↓18.3%1MITPHPPHP &gt;=7.4

Since Jul 2Pushed 1y ago2 watchersCompare

[ Source](https://github.com/rezozero/canonical-email)[ Packagist](https://packagist.org/packages/rezozero/canonical-email)[ RSS](/packages/rezozero-canonical-email/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (4)Versions (5)Used By (0)

canonical-email
===============

[](#canonical-email)

Simple PHP library to canonize email addresses from gmail.com, outlook.com or other providers that allow several forms of email.

[![Static analysis and code style](https://github.com/rezozero/canonical-email/actions/workflows/run-test.yml/badge.svg)](https://github.com/rezozero/canonical-email/actions/workflows/run-test.yml)

**Be careful: do not store canonical email as primary email for login or sending emails!**
Your users may not be able to login again to your site if they used a specific email syntax which differs from canonical. Only store canonical emails in order to test against duplicates and prevent new users from creating multiple accounts with same email using variants.

Always store `email` and `canonical_email` in your databases.

Strategies
----------

[](#strategies)

- `LowercaseDomainStrategy`: for every email, domain is case-insensitive, so it should be lowercased.
- `GmailStrategy`: for `@gmail.com` addresses or whatever domain which MX servers are from Google GSuite (if `$checkMxRecords` is `true`). This will remove any dots, and any character after `+` sign. Then all email parts will be lowercased. When MX are checked, your app will use PHP `getmxrr` function.
- `OutlookStrategy`: for `@outlook.com` addresses. This will remove any character after `+` sign.

Usage
-----

[](#usage)

```
composer require rezozero/canonical-email
```

```
use RZ\CanonicalEmail\EmailCanonizer;
use RZ\CanonicalEmail\Strategy\GmailStrategy;
use RZ\CanonicalEmail\Strategy\GSuiteStrategy;
use RZ\CanonicalEmail\Strategy\LowercaseDomainStrategy;
use RZ\CanonicalEmail\Strategy\OutlookStrategy;

$canonizer = new EmailCanonizer([
    new LowercaseDomainStrategy(),
    new GmailStrategy(),
    new GSuiteStrategy(),
    new OutlookStrategy()
]);

$canonizer->getCanonicalEmailAddress($email);
```

Running tests
-------------

[](#running-tests)

```
composer install

make test
```

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance38

Infrequent updates — may be unmaintained

Popularity36

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 70.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~538 days

Total

4

Last Release

532d ago

PHP version history (4 changes)1.0.0PHP ^7.0

1.0.1PHP ^7.2

1.0.2PHP &gt;=7.2

1.1.0PHP &gt;=7.4

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/380026?v=4)[Ambroise Maupate](/maintainers/ambroisemaupate)[@ambroisemaupate](https://github.com/ambroisemaupate)

---

Top Contributors

[![ambroisemaupate](https://avatars.githubusercontent.com/u/380026?v=4)](https://github.com/ambroisemaupate "ambroisemaupate (12 commits)")[![uintaam](https://avatars.githubusercontent.com/u/295346?v=4)](https://github.com/uintaam "uintaam (4 commits)")[![mwattier](https://avatars.githubusercontent.com/u/71347232?v=4)](https://github.com/mwattier "mwattier (1 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/rezozero-canonical-email/health.svg)

```
[![Health](https://phpackages.com/badges/rezozero-canonical-email/health.svg)](https://phpackages.com/packages/rezozero-canonical-email)
```

###  Alternatives

[morilog/jalali

This Package helps developers to easily work with Jalali (Shamsi or Iranian) dates in PHP applications, based on Jalali (Shamsi) DateTime class.

9201.2M45](/packages/morilog-jalali)[bruli/php-git-hooks

Git hooks for PHP projects.

675370.8k5](/packages/bruli-php-git-hooks)[nikolaposa/version

Value Object that represents a SemVer-compliant version number.

1406.4M16](/packages/nikolaposa-version)[prooph/common

Common classes used across prooph packages

852.2M27](/packages/prooph-common)[funeralzone/valueobjects

A PHP 7.1 value objects helper library.

66643.3k22](/packages/funeralzone-valueobjects)[tomasnorre/crawler

Crawler extension for TYPO3

58397.5k1](/packages/tomasnorre-crawler)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
