nepada/email-address
Composer 安装命令:
composer require nepada/email-address
包简介
Email address value object.
README 文档
README
Installation
Via Composer:
$ composer require nepada/email-address
Usage
This package provides two implementations of email address value object:
RfcEmailAddress- it adheres to RFCs and treats local part of email address as case sensitive. The domain part is normalized to lower case ASCII representation.CaseInsensitiveEmailAddress- the only difference fromRfcEmailAddressis that local part is considered case insensitive and normalized to lower case.
It is up to you to decide which implementation suites your needs. If you want to support both implementations, use Nepada\EmailAddress\EmailAddress as a typehint. You can also cast one representation to the other using RfcEmailAddress::toCaseInsensitiveEmailAddress() and CaseInsensitiveEmailAddress::toRfcEmailAddress().
Creating value object
$rfcEmailAddress = Nepada\EmailAddress\RfcEmailAddress::fromString('Real.example+suffix@HÁČKYčárky.cz'); $rfcEmailAddress = Nepada\EmailAddress\RfcEmailAddress::fromDomainAndLocalPart('HÁČKYčárky.cz', 'Real.example+suffix'); $ciEmailAddress = Nepada\EmailAddress\CaseInsensitiveEmailAddress::fromString('Real.example+suffix@HÁČKYčárky.cz'); $ciEmailAddress = Nepada\EmailAddress\CaseInsensitiveEmailAddress::fromDomainAndLocalPart('HÁČKYčárky.cz', 'Real.example+suffix');
Nepada\EmailAddress\InvalidEmailAddressException is thrown in case of invalid input value.
Converting back to string
Casting the value object to string, will result in the original (non-canonical) string representation of email address:
echo((string) $emailAddress); // Real.example+suffix@HÁČKYčárky.cz echo($emailAddress->toString()); // Real.example+suffix@HÁČKYčárky.cz
Canonical string representation of email address
echo($emailAddress->getValue()); // real.example+suffix@xn--hkyrky-ptac70bc.cz
Getting normalized local and domain part separately
echo($emailAddress->getLocalPart()); // real.example+suffix echo($emailAddress->getDomain()); // xn--hkyrky-ptac70bc.cz
Integrations
- nepada/email-address-doctrine - Email address type for Doctrine.
- nepada/email-address-input - Email address form input for Nette forms.
nepada/email-address 适用场景与选型建议
nepada/email-address 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 47.85k 次下载、GitHub Stars 达 8, 最近一次更新时间为 2018 年 06 月 02 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「nette」 「Value Object」 「email address」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 nepada/email-address 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 nepada/email-address 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 nepada/email-address 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A set of useful PHP classes.
Runn Me! Value Objects Library
Laravel SDK mapping data in object
MaxAl Subscriptions is a flexible plans and subscription management system for Laravel, with the required tools to run your SAAS like services efficiently. It's simple architecture, accompanied by powerful underlying to afford solid platform for your business.
Rinvex Subscriptions is a flexible plans and subscription management system for Laravel, with the required tools to run your SAAS like services efficiently. It's simple architecture, accompanied by powerful underlying to afford solid platform for your business.
Nette Framework adapter for I18n package
统计信息
- 总下载量: 47.85k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 8
- 点击次数: 23
- 依赖项目数: 2
- 推荐数: 1
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2018-06-02