Weave 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('[email protected]')
    ->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('[email protected]')
    ->setNewEmail('[email protected]')
    ->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"     => "[email protected]",
        "time_zone" => "America/Los_Angeles",
    ],
    (new Subscriber())->setEmail('[email protected]')->setTimeZone('America/Los_Angeles'),
];

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

Unsubscribe a batch of subscribers

$testData = [
    [
        "email"     => "[email protected]",
    ],
    (new Subscriber())->setEmail('[email protected]'),
];

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

Record a batch of events

$testData = [
    [
        "email"  => "[email protected]",
        "action" => "Opened a door",
    ],
    (new Event())->setEmail('[email protected]')->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.
steadrun/laravel-monitor
labyrinthe/connect-laravel
elmogy/layan
drewdan/sentinel-client
dskripchenko/laravel-llm
fatryst/nuonuo
stevenay/myanfont
gmostafa/php-graphql-client
xeviant/paystack
snowsoft/faker
meditationsteps/blogetc
animalyoung/laravel-influxdb
onix-solutions/sms-telera
lonely-lights/prosetta
oxygen/data
oxygen/core
jengo/base
xiloryx/log-collector
a21ns1g4ts/filament-stripe
la-php/laravel-admin