PHPackages                             zero-bounce/sdk - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. zero-bounce/sdk

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

zero-bounce/sdk
===============

The ZeroBounce SDK for PHP programming language

2.0.11(2mo ago)2365.4k↑14.8%101MITPHPPHP &gt;=7.0CI passing

Since Aug 5Pushed 2mo ago2 watchersCompare

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

READMEChangelog (10)Dependencies (2)Versions (32)Used By (1)

ZeroBounce PHP SDK
==================

[](#zerobounce-php-sdk)

This SDK contains methods for interacting easily with ZeroBounce API. More information about ZeroBounce can be find in the [official documentation](https://www.zerobounce.net/docs/).

Installation
------------

[](#installation)

To install the SDK you will need to use [composer](https://getcomposer.org/) in your project. If you're not using composer, you can install it like so:

```
curl -sS https://getcomposer.org/installer | php
# or
sudo apt install -y composer
```

To install the SDK with composer, run:

```
composer install zero-bounce/sdk
#or
composer require zero-bounce/sdk
```

### Laravel

[](#laravel)

This package is Laravel compatible as is:

```
composer create-project laravel/laravel laravel-zero-bounce-test
laravel-zero-bounce-test
composer require zero-bounce/sdk
php artisan make:command ZeroBounceTest
```

```
namespace App\Console\Commands;

use Illuminate\Console\Command;
use ZeroBounce\SDK\ZeroBounce;

class ZeroBounceTest extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'app:zero-bounce-test';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Command description';

    /**
     * Execute the console command.
     */
    public function handle()
    {
        ZeroBounce::Instance()->initialize("");
        $response = ZeroBounce::Instance()->getCredits();
        print_r($response);
    }
}
```

```
$ php artisan app:zero-bounce-test
ZeroBounce\SDK\ZBGetCreditsResponse Object
(
    [credits] => -1
)
```

However, this package is framework agnostic, so if you need it implemented in a service provider class, you'll need to [implement it](https://laravel.com/docs/10.x/providers).

Usage
-----

[](#usage)

- *include the SDK in your file (you should always use Composer's autoloader in your application to automatically load your dependencies)*

```
require 'vendor/autoload.php';
use ZeroBounce\SDK\ZeroBounce;
```

- *initialize the SDK with your API key*

```
ZeroBounce::Instance()->initialize("");
```

- *Optional: customize the base URL. Accepted values are `API_DEFAULT_URL`(default), `API_USA_URL` and `API_EU_URL`. Invalid values will fall back to the default one.*

```
// you can use the provided constants
use ZeroBounce\SDK\ZBBaseUrl;
// ...
ZeroBounce::Instance()->initialize("", ZBBaseUrl::API_USA_URL);
// or
ZeroBounce::Instance()->initialize("", ZBBaseUrl::API_EU_URL);

// you can also hardcode the URL
ZeroBounce::Instance()->initialize("", "https://api-us.zerobounce.net/v2");
// or
ZeroBounce::Instance()->initialize("", "https://api-eu.zerobounce.net/v2");
```

### *Method documentation*

[](#method-documentation)

- Verify an email address:

```
/** @var $response ZeroBounce\SDK\ZBValidateResponse */
$response = ZeroBounce::Instance()->validate(
                "",              // The email address you want to validate
                ""                  // The IP Address the email signed up from (Can be blank)
            );

// can be: valid, invalid, catch-all, unknown, spamtrap, abuse, do_not_mail
$status = $response->status;
```

- Verify a batch of email addresses:

```
/** @var response ZeroBounce\SDK\ZBBatchValidateResponse */
$response = ZeroBounce::Instance()->validateBatch([
		"EMAIL_ADDRESS_1", 		// Email address that needs to be validated
		"EMAIL_ADDRESS_2",
		"EMAIL_ADDRESS_3",
	...
	]);
// or
$response = ZeroBounce::Instance()->validateBatch([
		["EMAIL_ADDRESS_1", "IP_ADDRESS_1"],	// Email and IP address that need to be validated
		["EMAIL_ADDRESS_2", "IP_ADDRESS_2"],
		["EMAIL_ADDRESS_3", "IP_ADDRESS_3"],
		...
	]);
// =>
$response->emailBatch 	// array of ZBValidateReponse type objects
```

- Check how many credits you have left on your account

```
/** @var $response ZeroBounce\SDK\ZBGetCreditsResponse */
$response = ZeroBounce::Instance()->getCredits();
$credits = $response->credits;
```

- Check your API usage for a given period of time

```
$startDate = new DateTime("-1 month"); // The start date of when you want to view API usage
$endDate = new DateTime();             // The end date of when you want to view API usage

/** @var $response ZeroBounce\SDK\ZBApiUsageResponse */
$response = ZeroBounce::Instance()->getApiUsage($startDate, $endDate);
$usage = $response->total;
```

- Check the activity of a subscriber given their email account

```
/** @var $response ZeroBounce\SDK\ZBActivityResponse */
$response = ZeroBounce::Instance()->getActivity("");
$active_in_days = $response->activeInDays;
```

- Send a file for bulk email validation

```
/** @var $response ZeroBounce\SDK\ZBSendFileResponse */
$response = ZeroBounce::Instance()->sendFile(
    "",              // The csv or txt file
    "",   // The column index of the email address in the file. Index starts at 1
    "",             // The URL will be used as a callback after the file is sent
    "",      // The column index of the user's first name in the file
    "",       // The column index of the user's last name in the file
    "",          // The column index of the user's gender in the file
    "",      // The column index of the IP address in the file
    ""          // If the first row from the submitted file is a header row. True or False
);
$fileId = $response->fileId;    // e.g. "aaaaaaaa-zzzz-xxxx-yyyy-5003727fffff"
```

- Check the status of a file uploaded via "sendFile" method

```
$fileId = "";   // The file ID received from "sendFile" response

/** @var $response ZeroBounce\SDK\ZBFileStatusResponse */
$response = ZeroBounce::Instance()->fileStatus($fileId);
$status = $response->fileStatus;    // e.g. "Complete"
```

- Get the validation results file for the file been submitted using sendfile API

```
$fileId = "";              // The file ID received from "sendFile" response
$downloadPath = "";  // The path where the file will be downloaded

/** @var $response ZeroBounce\SDK\ZBGetFileResponse */
$response = ZeroBounce::Instance()->getFile($fileId, $downloadPath);
$localPath = $response->localFilePath;
```

- Deletes the file that was submitted using scoring sendfile API. File can be deleted only when its status is *`Complete`*

```
$fileId = "";              // The file ID received from "sendFile" response

/** @var $response ZeroBounce\SDK\ZBDeleteFileResponse */
$response = ZeroBounce::Instance()->deleteFile($fileId);
$success = $response->success;      // True / False
```

#### AI Scoring API

[](#ai-scoring-api)

- The scoring sendfile API allows a user to send a file for bulk email scoring

```
/** @var $response ZeroBounce\SDK\ZBSendFileResponse */
$response = ZeroBounce::Instance()->scoringSendFile(
    "",              // The csv or txt file
    "",   // The column index of the email address in the file. Index starts at 1
    "",             // The URL will be used as a callback after the file is sent
    ""          // If the first row from the submitted file is a header row. True or False
);
$fileId = $response->fileId;    // e.g. "aaaaaaaa-zzzz-xxxx-yyyy-5003727fffff"
```

- Check the status of a file uploaded via "scoringSendFile" method

```
$fileId = "";   // The file ID received from "sendFile" response

/** @var $response ZeroBounce\SDK\ZBFileStatusResponse */
$response = ZeroBounce::Instance()->scoringFileStatus($fileId);
$status = $response->fileStatus;    // e.g. "Complete"
```

- Get the validation results file for the file been submitted using scoringSendfile API

```
$fileId = "";              // The file ID received from "sendFile" response
$downloadPath = "";  // The path where the file will be downloaded

/** @var $response ZeroBounce\SDK\ZBGetFileResponse */
$response = ZeroBounce::Instance()->scoringGetFile($fileId, $downloadPath);
$localPath = $response->localFilePath;
```

- Deletes the file that was submitted using scoringSendfile API. File can be deleted only when its status is *`Complete`*

```
$fileId = "";              // The file ID received from "sendFile" response

/** @var $response ZeroBounce\SDK\ZBDeleteFileResponse */
$response = ZeroBounce::Instance()->scoringDeleteFile($fileId);
$success = $response->success;      // True / False
```

#### Email Finder API

[](#email-finder-api)

Guess an email address. The required arguments are `firstName` and either `domain` or `companyName`. If both are provided, only `domain` is used. If necessary, `domain` can be `null`.

```
$response = ZeroBounce::Instance()->findEmail(
    $domain, $firstName, $companyName, $middleName, $lastName
);
$email = $response->email;
```

Guess the format of email addresses for a domain or company. Must provide either `domain` or `companyName`. If both are provided, only `domain` is used. If necessary, `domain` can be `null`.

```
$response = ZeroBounce::Instance()->findEmailFormat($domain, $companyName);
$email = $response->format;
```

Development
-----------

[](#development)

### Run tests with Docker

[](#run-tests-with-docker)

From the **parent repository root** (the folder that contains all SDKs and `docker-compose.yml`):

```
docker compose build php
docker compose run --rm php
```

### Run tests (local)

[](#run-tests-local)

Install required PHP modules

```
sudo apt install -y php-curl php-dom php-xml php-xmlwriter
```

Install development dependencies

```
composer install --dev
```

Run tests

```
./vendor/bin/phpunit test
```

Publish
-------

[](#publish)

Releases are driven by **git tags**. [Packagist](https://packagist.org/packages/zero-bounce/sdk) picks up new versions automatically when you push a tag. No manual publish step. For the release workflow (version/tag from the SDKs repo), see the [sdk-docs](../sdk-docs/) guide (Packagist and RELEASE-WORKFLOW).

###  Health Score

57

—

FairBetter than 98% of packages

Maintenance85

Actively maintained with recent releases

Popularity42

Moderate usage in the ecosystem

Community26

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~100 days

Recently: every ~0 days

Total

25

Last Release

77d ago

Major Versions

v0.0.4 → v1.0.02023-04-06

v1.2.0 → v2.0.02026-02-26

PHP version history (2 changes)0.0.1PHP &gt;=7.1

v0.0.3PHP &gt;=7.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/cfc307fd02cd525c123b6a9ff09932f6495d415bfd2989e1a31a6eaf1bd95211?d=identicon)[zerobounce](/maintainers/zerobounce)

![](https://www.gravatar.com/avatar/5c74856859c7e16a9095a8093c3277b08fc877c892bede4763d717c83af37450?d=identicon)[aolariusst](/maintainers/aolariusst)

![](https://www.gravatar.com/avatar/40535428861083e1eec7ac6bf85be038fdd8fde2becf9ad1987798c7344b22ab?d=identicon)[antonio.bigan](/maintainers/antonio.bigan)

![](https://www.gravatar.com/avatar/3158287aaf05664a3ad85a4da986f23c3d0cea16b803c5826ff55e5fa2045634?d=identicon)[rvlasiu](/maintainers/rvlasiu)

---

Top Contributors

[![franciscbalint](https://avatars.githubusercontent.com/u/7178547?v=4)](https://github.com/franciscbalint "franciscbalint (29 commits)")[![vlungusst](https://avatars.githubusercontent.com/u/108796024?v=4)](https://github.com/vlungusst "vlungusst (19 commits)")[![andreinadabansst](https://avatars.githubusercontent.com/u/141480245?v=4)](https://github.com/andreinadabansst "andreinadabansst (12 commits)")[![aolariusst](https://avatars.githubusercontent.com/u/128606894?v=4)](https://github.com/aolariusst "aolariusst (8 commits)")[![VincentLanglet](https://avatars.githubusercontent.com/u/9052536?v=4)](https://github.com/VincentLanglet "VincentLanglet (6 commits)")[![antonio-bigan](https://avatars.githubusercontent.com/u/39882567?v=4)](https://github.com/antonio-bigan "antonio-bigan (3 commits)")[![mincua](https://avatars.githubusercontent.com/u/594930?v=4)](https://github.com/mincua "mincua (2 commits)")[![iasjennen](https://avatars.githubusercontent.com/u/12272672?v=4)](https://github.com/iasjennen "iasjennen (2 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")[![Pfannkuchensack](https://avatars.githubusercontent.com/u/1481193?v=4)](https://github.com/Pfannkuchensack "Pfannkuchensack (1 commits)")[![dancotetzb](https://avatars.githubusercontent.com/u/127088434?v=4)](https://github.com/dancotetzb "dancotetzb (1 commits)")[![andreiolariu](https://avatars.githubusercontent.com/u/98443?v=4)](https://github.com/andreiolariu "andreiolariu (1 commits)")[![zbdevs](https://avatars.githubusercontent.com/u/123769397?v=4)](https://github.com/zbdevs "zbdevs (1 commits)")

---

Tags

sdkzerobounce

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/zero-bounce-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/zero-bounce-sdk/health.svg)](https://phpackages.com/packages/zero-bounce-sdk)
```

###  Alternatives

[aws/aws-crt-php

AWS Common Runtime for PHP

420300.1M4](/packages/aws-aws-crt-php)[zumba/amplitude-php

PHP SDK for Amplitude

409.5M5](/packages/zumba-amplitude-php)[ennnnny/tbk

简约优雅的淘宝客SDK

29016.1k1](/packages/ennnnny-tbk)[anilcancakir/laravel-ai-sdk-skills

A skill system for Laravel AI SDK agents. Define reusable AI capabilities with SKILL.md files.

151.1k](/packages/anilcancakir-laravel-ai-sdk-skills)

PHPackages © 2026

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