plumpboy/email-validate
Composer 安装命令:
composer require plumpboy/email-validate
包简介
A library for validating email via SMTP, extends from https://github.com/semplon/php-smtp-email-validation
README 文档
README
A Library extending https://github.com/semplon/php-smtp-email-validation
What It Does ?
Check if email address exists via SMTP.
Requirement
- php >= 5.5
Installation
- composer require plumpboy/email-validate
Usage
... use Plumpboy\EmailValidate\SMTPEmailValidator; ... // the email to validate $email = 'user@example.com'; // $email can be array('user@example.com', 'user1@example.com') // an optional sender $sender = 'user@mydomain.com'; // instantiate the class $SMTPValidator = new SMTPEmailValidator(); // turn on debugging if you want to view the SMTP transaction $SMTPValidator->debug = true; // do the validation $results = $SMTPValidator->validate($email, $sender); // view results echo $email.' is '.($results ? 'valid' : 'invalid')."\n"; // $results[$email] when there are many emails // send email? if ($results) { // or $results['user@example.com'] if you pass many emails //mail($email, 'Confirm Email', 'Please reply to this email to confirm', 'From:'.$sender."\r\n"); // send email } else { echo 'The email addresses you entered is not valid'; }
Laravel
For projects use laravel version < 5.5, add below code into config/app.php.
... 'providers' => [ ... Plumpboy\EmailValidate\EmailValidateServiceProvider::class, ... ], ...
You also can use below syntax in laravel.
$result = email_exists($emails, $sender); // use helper
... use Plumpboy\EmailValidate\EmailValidator; ... $result = EmailValidator::validate($email, $sender); // use facade
$result = \EmailValidator::validate($email, $sender); // or alias
if you do not pass param $sender, library will use config('mail.from.address').
Contribute
- Fork the repository and make changes on your fork in a feature branch.
- Commit messages must start with a capitalized and short summary.
- After every commit, make sure the test suite passes.
- Contributor sends pull request to release/develop branch, ask another contributor to check if possible.
- Don't push private keys, logs or any unnecessary files to git repository
- Merge when pull request got 2 OK from contributors and CI build is green.
- Merge develop to master to release final version.
License
plumpboy/email-validate 适用场景与选型建议
plumpboy/email-validate 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 29 次下载、GitHub Stars 达 3, 最近一次更新时间为 2021 年 01 月 08 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 plumpboy/email-validate 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 plumpboy/email-validate 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 29
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 13
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: CC-BY-2.0
- 更新时间: 2021-01-08