2017 © Pedro Peláez
 

library drip

PHP library for interacting with the Drip API

image

drewm/drip

PHP library for interacting with the Drip API

  • Tuesday, March 27, 2018
  • by drewm
  • Repository
  • 3 Watchers
  • 14 Stars
  • 20,238 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 3 Forks
  • 2 Open issues
  • 9 Versions
  • 7 % Grown

The README.md

Drip

PHP library for making token-based API requests against Drip., (*1)

Build Status Scrutinizer Code Quality, (*2)

Install

Either download and include, or install via Composer:, (*3)

composer require drewm/drip

Make a simple request

Create a new Drip object with, (*4)

  1. Your user's API token (Settings > My User Settings > API Token)
  2. Your numeric account ID (Log into the Drip dashboard and it's the first segment in your URL)
use DrewM\Drip\Drip;
use DrewM\Drip\Dataset;

$Drip = new Drip('abc123', '1234567')

Create a new subscriber:, (*5)

$data = new Dataset('subscribers', [
                'email' => 'postmaster@example.com',
            ]);
$Response = $Drip->post('subscribers', $data);

List all subscribers:, (*6)

$Response = $Drip->get('subscribers');

To request a method without an account ID in the URL, (e.g. list accounts) :, (*7)

$Drip = new Drip('abc123');
$Response = $Drip->getGlobal('accounts');

To then subsequently set an account ID:, (*8)

$Drip->setAccountID('1234567');

Handling responses

Methods return a Response object, (*9)

if ($Response->status == 200) {
    // all is ok!
    $subscribers = $Response->subscribers;
} else {
    echo $Response->error;
    echo $Response->message;
}

Get the raw response:, (*10)

$raw = $Response->get();

Webhooks

You can listen for webhooks in a couple of ways. The most basic is:, (*11)

use DrewM\Drip\Drip;
$data = Drip::receiveWebhook();

If you prefer a pub/sub model, you can register listener callables:, (*12)

use DrewM\Drip\Drip;

Drip::subscribeToWebhook('subscriber.created', function($data){
    // A subscriber was created
});

Drip::subscribeToWebhook('subscriber.subscribed_to_campaign', function($data){
    // A subscriber was added to a campaign
});

The Versions

27/03 2018

dev-master

9999999-dev

PHP library for interacting with the Drip API

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

drip

27/03 2018

v0.8

0.8.0.0

PHP library for interacting with the Drip API

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

drip

22/01 2017

v0.7

0.7.0.0

PHP library for interacting with the Drip API

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

drip

05/07 2015

v0.6

0.6.0.0

PHP library for interacting with the Drip API

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

drip

05/07 2015

v0.5

0.5.0.0

PHP library for interacting with the Drip API

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

drip

03/07 2015

v0.4

0.4.0.0

PHP library for interacting with the Drip API

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

drip

03/07 2015

v0.3

0.3.0.0

PHP library for interacting with the Drip API

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

drip

03/07 2015

v0.2

0.2.0.0

PHP library for interacting with the Drip API

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

drip

01/07 2015

v0.1

0.1.0.0

PHP library for interacting with the Drip API

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

drip