antriver/laravel-unique-email-validator
Composer 安装命令:
composer require antriver/laravel-unique-email-validator
包简介
Laravel validation rule to check an email address is really unique.
README 文档
README
This provides a Laravel validation rule that improves upon the built in 'unique' rule when preventing the same email address being used more than once.
Some email providers (Gmail) allow you to use + in the email address to create 'aliases'. For example if your email address is somename@gmail.com you can also use:
and they all work. The normal 'unique' rule would allow these as they are all different. This rule sees these all as the same and will disallow using the same 'somename@gmail.com' account.
Some email providers (Gmail) also allow you to place periods anywhere before the @ sign in the email address and these will all work. For example if your email address is somename@gmail.com you can also use:
Requirements
Your MySQL server must support the non-greedy regex operator. This has been tested with MySQL 8 and MariaDB 10.2 so those versions or newer should work.
Installation
composer require antriver/laravel-unique-email-validator
Usage
$this->validate( $request, [ // Check for other use of the same email address in the users.email column. 'email' => [new \Antriver\LaravelUniqueEmailValidator\UniqueEmailRule('users', 'email')], ] );
Like the original unique rule you can specify certain rows should be excluded. This is useful when updating a user and that should not reject the user's existing registered email address:
$this->validate( $request, [ 'email' => [new \Antriver\LaravelUniqueEmailValidator\UniqueEmailRule('users', 'email', ['id' => 123])], // Where 123 is the 'id' of the existing user. ] );
antriver/laravel-unique-email-validator 适用场景与选型建议
antriver/laravel-unique-email-validator 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 10 次下载、GitHub Stars 达 0, 最近一次更新时间为 2020 年 12 月 31 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 antriver/laravel-unique-email-validator 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 antriver/laravel-unique-email-validator 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 10
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 4
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-12-31