unicodeveloper/laravel-email-validator
Composer 安装命令:
composer require unicodeveloper/laravel-email-validator
包简介
Provides a Facade to help validate and verify email addresses
关键字:
README 文档
README
Laravel 5 Package to help validate and verify your email addresses.
Note: This depends on the paid service from http://quickemailverification.com/.
Install
PHP 5.5+ or HHVM 3.3+, and Composer are required.
Via Composer
$ composer require unicodeveloper/laravel-email-validator
Another alternative is to simply add the following line to the require block of your composer.json file.
"unicodeveloper/laravel-email-validator": "1.0.*"
Then run composer install or composer update to download it and have the autoloader updated.
Add this to your providers array in config/app.php
// Laravel 5: config/app.php 'providers' => [ ... Unicodeveloper\EmailValidator\EmailValidatorServiceProvider::class, ... ];
This package also comes with a facade
// Laravel 5: config/app.php 'aliases' => [ ... 'EmailValidator' => Unicodeveloper\EmailValidator\EmailValidatorFacade::class, ... ]
Publish the config file by running:
php artisan vendor:publish
The config file will now be located at config/emailValidator.php.
Configuration
This is the emailValidator.php file in the config directory. Go to quickemailverification.com, sign up, get an api Key and insert here
/** * Config file that a user/developer can insert quickemailverficationservice api key */ return [ 'apiKey' => '' ];
Usage
With the Facades, all you need to do in your application is something like so:
print_r(EmailValidator::verify('kkkkk@example.com')->isValid()); // returns Array ( [0] => [1] => Could not get MX records for domain ) print_r(EmailValidator::verify('prosperotemuyiwa@gmail.com')->isValid()); // returns Array ( [0] => 1 [1] => SMTP server accepted email address ) var_dump( EmailValidator::verify('prosperotemuyiwa@gmail.com')->isValid()[0]); // returns bool(true) var_dump( EmailValidator::verify('kkkkk@example.com')->isValid()[0]); // returns bool(false) if( EmailValidator::verify('kkkkk@example.com')->isValid()[0] ){ ...... } // returns a true/false if the email address is valid or not
Other Methods Available
/** * Returns true or false if the email address uses a disposable domain * @return boolean */ EmailValidator::verify('kkkkk@example.com')->isDisposable()
/** * Returns true or false if the API request was successful * @return boolean */ EmailValidator::verify('kkkkk@example.com')->apiRequestStatus()
/** * Get the domain of the provided email address * @return string */ EmailValidator::verify('kkkkk@example.com')->getDomainName()
/** * Get the local part of an email address * Example: kkkkk@example.com returns kkkkk * @return string */ EmailValidator::verify('kkkkk@example.com')->getUser()
/** * Gets a normalized version of the email address * Example: KkkKk@example.com returns kkkkk@gmail.com * @return string */ EmailValidator::verify('kkkkk@example.com')->getEmailAddress()
/** * Returns true if the domain appears to accept all emails delivered to that domain * @return boolean */ EmailValidator::verify('kkkkk@example.com')->acceptEmailsDeliveredToDomain()
/** * Returns true or false if email address is a role address * Example manager@example.com , ceo@example.com will return true * @return boolean */ EmailValidator::verify('kkkkk@example.com')->isRole()
Change log
Please see CHANGELOG for more information what has changed recently.
Todo: Testing
Todo: Verify a list of emails
You can run the tests with:
vendor/bin/phpunit run
Alternatively, you can run the tests like so:
composer test
Contributing
Please see CONTRIBUTING for details.
How can I thank you?
Why not star the github repo? I'd love the attention! Why not share the link for this repository on Twitter or HackerNews? Spread the word!
Don't forget to follow me on twitter!
Thanks! Prosper Otemuyiwa.
License
The MIT License (MIT). Please see License File for more information.
unicodeveloper/laravel-email-validator 适用场景与选型建议
unicodeveloper/laravel-email-validator 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 33.85k 次下载、GitHub Stars 达 23, 最近一次更新时间为 2015 年 11 月 01 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel」 「validate」 「verify」 「Year」 「busayo」 「laravel-email-validator」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 unicodeveloper/laravel-email-validator 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 unicodeveloper/laravel-email-validator 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 unicodeveloper/laravel-email-validator 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Runn Me! Validation and Sanitization Library
Supercharged text field validation.
Integration bundle for Aura.Input with Aura.Filter
Bureaux A Partager Edit - Parse, validate, manipulate, and display dates in PHP w/ i18n support. Inspired by moment.js
Zend Framework 1 Validate package
HTML-Form Checker
统计信息
- 总下载量: 33.85k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 26
- 点击次数: 6
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-11-01