knack/zerobounce 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

knack/zerobounce

最新稳定版本:1.0.4

Composer 安装命令:

composer require knack/zerobounce

包简介

Knack Zerobounce API wrapper

README 文档

README

Knack Technologies, Inc.

Knack ZeroBounce PHP API Wrapper

Installing Knack's ZeroBounce

The recommended way to install Knack's ZeroBounce is through Composer. PHP 7.2+ Required.

composer require knack/zerobounce

Example usage

Laravel
<?php

use Knack\ZeroBounce\API\ZeroBounce;
use Knack\ZeroBounce\Enums\StatusEnum;

class EmailService {
    /**
     * @var ZeroBounce
     */
    private $zeroBounce;

    /**
     * EmailService constructor.
     *
     * @param ZeroBounce $zeroBounce
     */
    public function __construct(ZeroBounce $zeroBounce) {
        $this->zeroBounce = $zeroBounce;
    }

    /**
     * Validates an email address from blacklists and verifies that that domain is real.
     *
     * @param string $emailAddress
     * @param string $ipAddress
     *
     * @return bool
     */
    public function isValid(string $emailAddress, string $ipAddress = ''): bool
    {
        $response = $this->zeroBounce->validate($emailAddress, $ipAddress);

        if($response->status === StatusEnum::VALID) {
            return true;
        }

        return false;
    }
}
Vanilla PHP
<?php

use Knack\ZeroBounce\API\ZeroBounce;
use Knack\ZeroBounce\Enums\StatusEnum;

class EmailService {
    /**
     * @var ZeroBounce
     */
    private $zeroBounce;

    /**
     * EmailService constructor.
     */
    public function __construct() {
        $this->zeroBounce = new ZeroBounce(getenv('ZEROBOUNCE_API_KEY'));
    }

    /**
     * Validates an email address from blacklists and verifies that that domain is real.
     *
     * @param string $emailAddress
     * @param string $ipAddress
     *
     * @return bool
     */
    public function isValid(string $emailAddress, string $ipAddress = ''): bool
    {
        $response = $this->zeroBounce->validate($emailAddress, $ipAddress);

        if($response->status === StatusEnum::VALID) {
            return true;
        }

        return false;
    }
}

Documentation

Contributing

Submitting PRs

To submit a Pull Request to this repo, just simply open up the Pull Request targeting develop.

Please ensure all tests are passing prior to submitting your Pull Request.

Running the tests

composer test

Any of the following email addresses can be used for testing the API, no credits are charged for these test email addresses:

You can this IP to test the GEO Location in the API.

  • 99.110.204.1

统计信息

  • 总下载量: 18.38k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: mit
  • 更新时间: 2020-02-04