PHP code example of drewm / drip

1. Go to this page and download the library: Download drewm/drip library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

drewm / drip example snippets


use DrewM\Drip\Drip;
use DrewM\Drip\Dataset;

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

$data = new Dataset('subscribers', [
				'email' => '[email protected]',
			]);
$Response = $Drip->post('subscribers', $data);

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

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

$Drip->setAccountID('1234567');

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

$raw = $Response->get();

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

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
});