rezozero/canonical-email 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

rezozero/canonical-email

Composer 安装命令:

composer require rezozero/canonical-email

包简介

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

README 文档

README

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

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

  • 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

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

composer install

make test

统计信息

  • 总下载量: 64.73k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 12
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 12
  • Watchers: 2
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-09-26

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固