nojacko/email-validator
最新稳定版本:1.1.2
Composer 安装命令:
composer require nojacko/email-validator
包简介
Small PHP library to valid email addresses using a number of methods.
关键字:
README 文档
README
Small PHP library to valid email addresses using a number of methods.
Features
- Validates email address
- Checks for example domains (e.g. example.com)
- Checks for disposable email domains (e.g. mailinator.com)
- Checks for role-based addresses (e.g. abuse@)
- Checks for MX records (i.e. can receive email)
Install (using Composer)
composer require nojacko/email-validator:~1.0
Usage
Generalised Functions
isValid($email)Runs all the tests within this library. Returns true or false.isSendable($email)Checks isEmail, isExample and hasMx. Returns true or false.
Specific Functions
If you want more control, use these functions seperately.
isEmail($email)Note: returns true or false only.isExample($email)isDisposable($email)isRole($email)hasMx($email)
These functions take a single argument (an email address) and return:
- true, when function name is satisfied.
- false, when function name is not satisfied.
- null, when check is not possible, i.e. an invalid email is given.
Examples
$validator = new \EmailValidator\Validator();
$validator->isValid('example@google.com'); // true
$validator->isValid('abuse@google.com'); // false
$validator->isValid('example@example.com'); // false
$validator->isSendable('example@google.com'); // true
$validator->isSendable('abuse@google.com'); // true
$validator->isSendable('example@example.com'); // false
$validator->isEmail('example@example.com'); // true
$validator->isEmail('example@example'); // false
$validator->isExample('example@example.com'); // true
$validator->isExample('example@google.com'); // false
$validator->isExample('example.com'); // null
$validator->isDisposable('example@example.com'); // false
$validator->isDisposable('example@mailinater.com'); // true
$validator->isDisposable('example.com'); // null
$validator->isRole('example@example.com'); // false
$validator->isRole('abuse@example.com'); // true
$validator->isRole('example.com'); // null
$validator->hasMx('example@example.com'); // false
$validator->hasMx('example@google.com'); // true
$validator->hasMx('example.com'); // null
Contribute
Contributions welcome!
Requirements
- Test-driven development
- Follow PSR-2 Coding Style Guide
- One change per pull request
Add/Remove Disposable Domain
See the email-data-disposable project.
New Feature
If you're planning a new feature, please raise an issue first to ensure it's in scope. The aim is to keep this library small and with one specific purpose.
Other Contributions
For anything that isn't a new feature (bug fix, tests, etc) just create a pull request.
Testing
Test are all located in tests folder.
Run tests with phpunit. In root folder, execute phpunit in a CLI.
Versioning
License
The MIT License (MIT). See LICENCE file.
nojacko/email-validator 适用场景与选型建议
nojacko/email-validator 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 363.01k 次下载、GitHub Stars 达 153, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「library」 「email」 「validation」 「check」 「email address」 「MX」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 nojacko/email-validator 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 nojacko/email-validator 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 nojacko/email-validator 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Inbox pattern process implementation for your Laravel Applications
Adds request-parameter validation to the SLIM 3.x PHP framework
Extensible library for building notifications and sending them via different delivery channels.
Email+ extends Kirby's email capabilities by adding support for multiple email services using the same Kirby email API.
A jQuery augmented PHP library for creating and validating HTML forms
A Laravel validator for delimiter-separated list of emails.
统计信息
- 总下载量: 363.01k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 159
- 点击次数: 29
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 未知