nepada/email-address-input
Composer 安装命令:
composer require nepada/email-address-input
包简介
Email address form input for Nette forms.
关键字:
README 文档
README
Installation
Via Composer:
$ composer require nepada/email-address-input
Option A: install form container extension method via DI extension
extensions: - Nepada\Bridges\EmailAddressInputDI\EmailAddressInputExtension
It will register extension method addEmailAddress($name, $label, $caseSensitive = false) to Nette\Forms\Container.
Option B: use trait in your base form/container class
You can also use EmailAddressInputMixin trait in your base form/container class to add method addEmailAddress($name, $label, $caseSensitive = false).
Example:
trait FormControls { use Nepada\Bridges\EmailAddressInputForms\EmailAddressInputMixin; public function addContainer($name) { $control = new Container; $control->setCurrentGroup($this->getCurrentGroup()); if ($this->currentGroup !== null) { $this->currentGroup->add($control); } return $this[$name] = $control; } } class Container extends Nette\Forms\Container { use FormControls; } class Form extends Nette\Forms\Form { use FormControls; }
Usage
EmailAddressInput is form control that uses email address value object to represent its value (see nepada/email-address for further details).
It automatically validates the user input and getValue() method always returns EmailAddress instance, or null if the input is not filled.
$emailAddressInput = $form->addEmailAddress('E-mail'); // set value using EmailAddress value object $emailAddressInput->setValue(CaseInsensitiveEmailAddress::fromString('example@example.com')); // set value using string with a valid email address (it is internally converted to EmailAddress value object) $emailAddressInput->setValue('example@example.com'); // Get EmailAddress instance for example@example.com $emailAddressInput->getValue(); // InvalidEmailAddressException is thrown $emailAddressInput->setValue('42');
Case sensitivity
By default the input returns instance of CaseInsensitiveEmailAddress, i.e. the value object that treats the whole email address as case insensitive.
You can change this behaviour by calling EmailAddressInput::setCaseSensitive(true), or by passing $caseSensitive = true when creating the input. With enabled case sensitivity the input's value will be represented as RfcEmailAddress instance.
For further details see the readme of nepada/email-address.
nepada/email-address-input 适用场景与选型建议
nepada/email-address-input 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 6.69k 次下载、GitHub Stars 达 3, 最近一次更新时间为 2018 年 06 月 03 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「form」 「nette」 「input」 「email address」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 nepada/email-address-input 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 nepada/email-address-input 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 nepada/email-address-input 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Yii2 map input widget. Allows you to select geographcal coordinates via a human-friendly inteface.
Widget to add a remaining character counter to text inputs and textareas
Diese Contao 4 Erweiterung stellt Google reCAPTCHA V2 in Form eines neuen Formularfeldes im Formulargenerator bereit. This extension provides Google reCAPTCHA V2 in the form of a new form field in the form generator of Contao Open Source CMS.
Native (browser) color input field for SilverStripe
Integration bundle for Aura.Input with Aura.Filter
Nette Framework adapter for I18n package
统计信息
- 总下载量: 6.69k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 12
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2018-06-03