andi/kickbox-bundle
最新稳定版本:1.1.0
Composer 安装命令:
composer require andi/kickbox-bundle
包简介
Symfony Kickbox Bundle
README 文档
README
Email Verification Library for Symfony
Kickbox determines if an email address is not only valid, but associated with a actual user. Uses include:
- Preventing users from creating accounts on your applications using fake, misspelled, or throw-away email addresses.
- Reducing bounces by removing old, invalid, and low quality email addresses from your mailing lists.
- Saving money and projecting your reputation by only sending to real email users.
Getting Started
To begin, hop over to kickbox.io and create a free account. Once you've signed up and logged in, click on API Settings and then click Add API Key. Take note of the generated API Key - you'll need it to setup the client as explained below.
Installation
Make sure you have composer installed.
Add the following to your composer.json
$ php composer.phar require andi/kickbox-bundle
This package follows the
PSR-4convention names for its classes, which means you can easily integrate these classes loading in your own autoloader.
Register the bundle in app/AppKernel.php
public function registerBundles() { $bundles = array( new Andi\KickBoxBundle\AndiKickBoxBundle(), ); }
In your config.yml, you must configure:
# Default configuration for extension with alias: "andi_kick_box" andi_kick_box: # API key list. api_keys: # Required toto: # The api key generated in kickbox.io. key: YOU_API_KEY # Required tata: key: AN_OTHER_API_KEY # The default API name. If not set, the default value will be the first api name. default_api_name: tata # The endpoint of the kickbox API. endpoint: 'https://api.kickbox.io/v2/verify'
Usage
Add the following code to our controller:
public function indexAction($email) { $kickboxClient = $this->get('kickbox_client'); $response = $kickboxClient->verify($email); }
We can also get a service name with a specific key defined in config.yml
Example:
$kickboxClient = $this->get('kickbox_client'); // The default client. In our example : tata $kickboxClient = $this->get('kickbox_client.tata'); $kickboxClient = $this->get('kickbox_client.toto');
To simply verify an email :
$response = $kickboxClient->verify($email);
With a timeout :
// Maximum time, in milliseconds, for the API to complete a verification request. Default value : 6000 $response = $kickboxClient->verify($email, 6000);
An exception can be thrown by the api client if the HTTP status code is not 200 : Andi\KickBoxBundle\Exception\KickBoxApiException
Response
A successful API call responds with the following object:
$response->getBalance(); // The remaining credit balance (Daily + On Demand). $response->getDomain(); // The domain of the provided email address. $response->getEmail(); // Returns a normalized version of the provided email address. $response->getReason(); // The reason for the result. $response->getResponseTime(); // The elapsed time (in milliseconds) it took Kickbox to process the request. $response->getResult(); // The verification result: deliverable, undeliverable, risky, unknown $response->getSuggestion(); // Returns a suggested email if a possible spelling error was detected. $response->getSendex(); // A quality score of the provided email address ranging between 0 (no quality) and 1 (perfect quality). $response->getUser(); // The user (a.k.a local part) of the provided email address. (bob@example.com -> bob). $response->isAcceptAll(); // If the email was accepted, but the domain appears to accept all emails addressed to that domain. $response->isDisposable(); // If the email address uses a disposable domain like trashmail.com or mailinator.com. $response->isFree(); // If the email address uses a free email service like gmail.com or yahoo.com. $response->isRole(); // If the email address is a role address $response->isSuccess(); // If the API request was successful.
All the Kickbox API is explained here : Using api API
andi/kickbox-bundle 适用场景与选型建议
andi/kickbox-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 5.33k 次下载、GitHub Stars 达 3, 最近一次更新时间为 2015 年 06 月 02 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「api」 「kickbox」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 andi/kickbox-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 andi/kickbox-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 andi/kickbox-bundle 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Official kickbox API library client for PHP
A kickbox email validator for form requests in laravel
A PSR-7 compatible library for making CRUD API endpoints
Zend Framework 2 Module that provides email validation via http://kickbox.io
An implementation of kickbox.io email validation api for Laravel
A kickbox email validator for form requests in laravel (forked from 'stayum')
统计信息
- 总下载量: 5.33k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 12
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-06-02