alexeevdv/yii2-zerobounce-client

Yii2 client for zerobounce.net API

Installs: 5 637

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 2

Open Issues: 0

Type:yii2-extension

1.6.0 2019-08-15 08:47 UTC

This package is auto-updated.

Last update: 2024-03-15 22:15:52 UTC


README

Build Status codecov PHP 7.1 PHP 7.2 PHP 7.3

Yii client for https://www.zerobounce.net API

API docs are available at https://www.zerobounce.net/docs/

Installation

The preferred way to install this extension is through composer.

Either run

$ composer require alexeevdv/yii2-zerobounce-client "^1.0"

or add

"alexeevdv/yii2-zerobounce-client": "^1.0"

to the require section of your composer.json file.

Configuration

'container' => [
    'singletons' => [
        alexeevdv\yii\zerobounce\ClientInterface::class => [
            'class' => alexeevdv\yii\zerobounce\Client::class,
            'apiKey' => 'a95c530a7af5f492a74499e70578d150',         
        ],
    ],
],

Usage

Validate email

$client = yii\di\Instance::ensure(alexeevdv\yii\zerobounce\ClientInterface::class);
$result = $client->validate('valid@example.com');
if ($result->isValid()) {
    // do your stuff
}

Get credits

$client = yii\di\Instance::ensure(alexeevdv\yii\zerobounce\ClientInterface::class);
$credits = $client->getCredits();

Send file

$client = yii\di\Instance::ensure(alexeevdv\yii\zerobounce\BulkClientInterface::class);
$result = $client->sendFile('file.csv', 'http://site.com/your-postback-link/');

Read file

$client = yii\di\Instance::ensure(alexeevdv\yii\zerobounce\BulkClientInterface::class);
//File uuid received from sendFile response
$result = $client->readFile($uuid);

Delete file

$client = yii\di\Instance::ensure(alexeevdv\yii\zerobounce\BulkClientInterface::class);
//File uuid received from sendFile response
$result = $client->deleteFile($uuid);