PHPackages                             nickdnk/zerobounce-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. nickdnk/zerobounce-php

ActiveLibrary[API Development](/categories/api)

nickdnk/zerobounce-php
======================

OOP integration with the ZeroBounce API.

1.3.0(3y ago)3185.3k↓38.5%1MITPHPPHP ^7.1 || ^8.0CI failing

Since Mar 31Pushed 3y ago1 watchersCompare

[ Source](https://github.com/nickdnk/zerobounce-php)[ Packagist](https://packagist.org/packages/nickdnk/zerobounce-php)[ RSS](/packages/nickdnk-zerobounce-php/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (11)Used By (0)

ZeroBounce PHP Library
======================

[](#zerobounce-php-library)

[![example workflow](https://github.com/nickdnk/zerobounce-php/actions/workflows/test.yml/badge.svg)](https://github.com/nickdnk/zerobounce-php/actions/workflows/test.yml)

This library will allow you to integrate the **ZeroBounce** API in your project using modern PHP7 and an OOP structure.

### Prerequisites

[](#prerequisites)

You need an active account at  to use this library. From there, grab your API Key under **API - Keys &amp; Info**.

### Installation

[](#installation)

To include this in your project, install it using Composer.

As we use return types and type hints, this library requires PHP 7.1 and works on all versions up until PHP 8.1

`composer require nickdnk/zerobounce-php`

### Tests

[](#tests)

Enter your API key into the `ZeroBounceTest` file and run it. This uses the test-emails supplied by ZeroBounce and will not cost you credit.

### How to use

[](#how-to-use)

```
use nickdnk\ZeroBounce\Email;
use nickdnk\ZeroBounce\Result;
use nickdnk\ZeroBounce\ZeroBounce;

// You can modify the timeout using the second parameter. Default is 15.
// You an also pass proxy options to Guzzle using the third parameter.
// See https://docs.guzzlephp.org/en/stable/request-options.html#proxy for details.
$handler = new ZeroBounce('my_api_key', 30, ['https' => 'https://my-proxy-server']);

$email = new Email(

    // The email address you want to check
    'some-email@domain.com',

    // and if you have it, the IP address - otherwise null or omitted
    '123.123.123.123'

);

try {

    // Validate the email
    $result = $handler->validateEmail($email);

    if ($result->getStatus() === Result::STATUS_VALID) {

        // All good

        if ($result->isFreeEmail()) {

            // Email address is free, such as @gmail.com, @hotmail.com.

        }

        /**
        * The user object contains metadata about the email address
        * supplied by ZeroBounce. All of these may be null or empty
        * strings, so remember to check for that.
        */
        $user = $result->getUser();

        $user->getCountry();
        $user->getRegion();
        $user->getZipCode();
        $user->getCity();
        $user->getGender();
        $user->getFirstName();
        $user->getLastName();

    } else if ($result->getStatus() === Result::STATUS_DO_NOT_MAIL) {

        // The substatus code will help you determine the exact issue:

        switch ($result->getSubStatus()) {

            case Result::SUBSTATUS_DISPOSABLE:
            case Result::SUBSTATUS_TOXIC:
                // Toxic or disposable.
                break;

            case Result::SUBSTATUS_ROLE_BASED:
                // admin@, helpdesk@, info@ etc; not a personal email
                break;

            // ... and so on.

        }

    } else if ($result->getStatus() === Result::STATUS_INVALID) {

        // Invalid email.

    } else if ($result->getStatus() === Result::STATUS_SPAMTRAP) {

        // Spam-trap.

    } else if ($result->getStatus() === Result::STATUS_ABUSE) {

        // Abuse.

    } else if ($result->getStatus() === Result::STATUS_CATCH_ALL) {

        // Address is catch-all; not necessarily a private email.

    } else if ($result->getStatus() === Result::STATUS_UNKNOWN) {

        // Unknown email status.

    }

    /*
     * To find out how to use and react to different status and
     * substatus codes, see the ZeroBounce documentation at:
     * https://www.zerobounce.net/docs/?swift#version-2-v2
     */

} catch (\nickdnk\ZeroBounce\HttpException $exception) {

   // ZeroBounce returned an error of some kind. Message is best-effort parsing.
   $exception->getMessage();
   // The response is available here also.
   // The HTTP code is 200 for 400-range problems, such as invalid credentials,
   // so don't rely too much on that. It is included mostly for debugging purposes.
   $exception->getResponse();

} catch (\nickdnk\ZeroBounce\ConnectionException $exception) {

   // There was a problem connecting to ZeroBounce or the connection timed out waiting for a reply.
   $exception->getMessage(); // will always return generic "request timed out or failed" message

} catch (\nickdnk\ZeroBounce\APIError $exception) {

   // Base exception. Both HttpException and ConnectionException extend from this, so you can
   // catch this to handle both errors. The somewhat odd naming for this was to avoid
   // introducing breaking changes when HttpException and ConnectionException was added.
   $exception->getMessage();

}
```

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity35

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity71

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~141 days

Recently: every ~126 days

Total

10

Last Release

1329d ago

PHP version history (2 changes)1.0PHP ^7.1

1.1.0PHP ^7.1 || ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/980f8465e8c1fc6dc77f2d705d73594f704e2337604e96bde86c42de40bf9aac?d=identicon)[nickdnk](/maintainers/nickdnk)

---

Top Contributors

[![nickdnk](https://avatars.githubusercontent.com/u/8411314?v=4)](https://github.com/nickdnk "nickdnk (12 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/nickdnk-zerobounce-php/health.svg)

```
[![Health](https://phpackages.com/badges/nickdnk-zerobounce-php/health.svg)](https://phpackages.com/packages/nickdnk-zerobounce-php)
```

###  Alternatives

[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3731.2M42](/packages/tencentcloud-tencentcloud-sdk-php)[convertkit/convertkitapi

Kit PHP SDK for the Kit API

2167.1k1](/packages/convertkit-convertkitapi)[mapado/rest-client-sdk

Rest Client SDK for hydra API

1125.9k2](/packages/mapado-rest-client-sdk)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
