Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Drip Php Laravel Package

glorand/drip-php

View on GitHub
Deep Wiki
Context7

Drip PHP

A PHP wrapper for Drip's REST API v2.0 for PHP 7.1+

Author: Gombos Lorand

Table of contents

Installation

$ composer require glorand/drip-php
{
    "require": {
        "glorand/drip-php": "^1.0"
    }
}

Current Features

Instantiation

use Glorand\Drip\Drip;

$drip = new Drip('your-account-id', 'your-api-token', 'user-agent-optional');

ApiResponse

Methods

//http status code
public function getStatusCode(): int {}

public function isSuccess(): bool {}

public function getHttpMessage(): string {}

//drip response
public function getContents(): array {}

Accounts

List all accounts

$accounts = $drip->accounts()->list();

if($accounts->isSuccess()) {
    foreach($accounts->getContents() as $acount) {
        //
    }
}

Fetch an account

$account = $drip->accounts()->show('acount-id');

if($account->isSuccess()) {
    // $account->getContents()
}

Events

Event Model

$event = new Event();
$event->setEmail('test@email.com')
    ->setAction('Action')
    ->setOccurredAt(new \DateTime('2018-12-01'))
    ->setProperties(['prop_0' => 'val_prop_0'])
    ->addProperty('prop_1', 'val_prop_1')
    ->removeProperty('prop_1');

Record an event

/** Event Model */
$event = new Event();

/** boolean */
$drip->events()->store($event);

List all custom events actions used in an account

/** ApiResponse */
$events = $drip->events()->list();

Subscribers

Subscriber Model

$subscriber = new Subscriber();
$subscriber->setEmail('test@email.com')
    ->setNewEmail('new@email.com')
    ->addCustomField('custom_f_1', 'val_custom_f_1')
    ->removeCustomField('custom_f_0')
    ->addTag('tag_1', 'val_tag_1')
    ->removeTag('tag_2')

Create or update a subscriber

/** Subscriber Model */
$subscriber = new Subscriber(); 

/** boolean */
$drip->subscribers()->store($subscriber);

List all subscribers

/** ApiResponse */
$events = $drip->subscribers()->list();

Batch Operations

Create or update a batch of subscribers

$testData = [
    [
        "email"     => "john@acme.com",
        "time_zone" => "America/Los_Angeles",
    ],
    (new Subscriber())->setEmail('joe@acme.com')->setTimeZone('America/Los_Angeles'),
];

/** boolean */
$drip->subscribers()->batchStore($testData);

Unsubscribe a batch of subscribers

$testData = [
    [
        "email"     => "john@acme.com",
    ],
    (new Subscriber())->setEmail('joe@acme.com'),
];

/** boolean */
$drip->subscribers()->batchUnsubscribe($testData);

Record a batch of events

$testData = [
    [
        "email"  => "john@acme.com",
        "action" => "Opened a door",
    ],
    (new Event())->setEmail('joe@acme.com')->setAction('Closed a door'),
];

/** boolean */
$drip->events()->batchStore($testData);

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

License

The MIT License (MIT). Please see LICENSE for more information.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
codeflextech/permission-manager
karnoweb/livewire-datepicker
sayedenam/sayed-dashboard
milito/query-filter
apiboxsym/user-bundle
apiboxsym/health-check-bundle
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui
babelqueue/php-sdk
facebook/capi-param-builder-php
babelqueue/symfony
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver