定制 whois-api/email-verifier 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

whois-api/email-verifier

Composer 安装命令:

composer require whois-api/email-verifier

包简介

The simplest possible way to verify an email address in PHP.

README 文档

README

The simplest possible way to verify an email in PHP.

Prerequisites

To use this library, you'll need to create a free Email Verification account: https://emailverification.whoisxmlapi.com/

If you haven't done this yet, please do so now.

Installation

To install email-verifier using composer, simply run:

$ composer require whois-api/email-verifier

In the root of your project directory.

To use the library, use Composer's autoload

require_once __DIR__ . "/vendor/autoload.php";

Requirements

Supported PHP versions:

  • PHP 5.6.x
  • PHP 7.0.x
  • PHP 7.1.x
  • PHP 7.2.x

Dependencies:

  • mbstring
  • mbregex
  • json
  • curl

Documentation

Full API documentation available here

Usage

Once you have email-verifier installed, you can use it to easily verify an email address. Email verification performs a number of checks to ensure a given email address is actually valid.

This library gives you access to all sorts of email verification data that you can use in your application in any number of ways.

<?php
require_once  __DIR__ . '/../vendor/autoload.php';

use WhoisApi\EmailVerifier\Builders\ClientBuilder;


$builder = new ClientBuilder();

$client = $builder->build('Your API key');

try {
    echo $client->getRawData('support@whoisxmlapi.com', 'json') . PHP_EOL;
    /* Disable refreshing */
    echo print_r($client->get('support@whoisxmlapi.com', ['_hardRefresh']), true) . PHP_EOL;
    
    $result = $client->get('support@whoisxmlapi.com', ['_hardRefresh']);
    echo 'Email: ' . $result->emailAddress . PHP_EOL;
    echo 'Format: ' . ($result->formatCheck ? 'valid' : 'invalid') . PHP_EOL;
    echo 'DNS: '. ($result->dnsCheck ? 'resolved' : 'not resolved') . PHP_EOL;
    echo 'SMTP: ' . ($result->smtpCheck ? 'working' : 'not working') . PHP_EOL;
    echo 'Free: ' . ($result->freeCheck ? 'yes' : 'no') . PHP_EOL;
    echo 'Catch all: ' . ($result->catchAllCheck ? 'yes' : 'no') . PHP_EOL;
    echo 'Disposable: ' . ($result->disposableCheck ? 'yes' : 'no') . PHP_EOL;
} catch (\Throwable $exception) {
    echo "Error: {$exception->getCode()} {$exception->getMessage()}" . PHP_EOL;
}

More examples you can see in the "examples" directory.

Before run these examples you need to specify your API key as an environment variable:

export API_KEY="<Your-API-key>"

php examples/basic.php

Here's the sort of data you might get back when performing a email verification request:

{
  "emailAddress": "support@whoisxmlapi.com",
  "formatCheck": "true",
  "smtpCheck": "true",
  "dnsCheck": "true",
  "freeCheck": "false",
  "disposableCheck": "false",
  "catchAllCheck": "true",
  "mxRecords": [
    "ALT1.ASPMX.L.GOOGLE.com",
    "ALT2.ASPMX.L.GOOGLE.com",
    "ASPMX.L.GOOGLE.com",
    "ASPMX2.GOOGLEMAIL.com",
    "ASPMX3.GOOGLEMAIL.com",
    "mx.yandex.net"
  ],
  "audit": {
    "auditCreatedDate": "2018-04-19 18:12:45.000 UTC",
    "auditUpdatedDate": "2018-04-19 18:12:45.000 UTC"
  }
}

Development

After you clone this repository you need to install all requirements:

$ composer install

To run tests you can use the following command

$ composer run-script test

whois-api/email-verifier 适用场景与选型建议

whois-api/email-verifier 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 198 次下载、GitHub Stars 达 4, 最近一次更新时间为 2018 年 09 月 21 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 whois-api/email-verifier 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 whois-api/email-verifier 我们能提供哪些服务?
定制开发 / 二次开发

基于 whois-api/email-verifier 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 198
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 4
  • 点击次数: 11
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 4
  • Watchers: 2
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-09-21