2017 © Pedro Peláez
 

library php-autopilothq

PHP wrapper for interacting with the AutopilotHQ API.

image

picr/php-autopilothq

PHP wrapper for interacting with the AutopilotHQ API.

  • Thursday, May 31, 2018
  • by nicolasThal
  • Repository
  • 6 Watchers
  • 8 Stars
  • 16,800 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 10 Forks
  • 5 Open issues
  • 5 Versions
  • 26 % Grown

The README.md

php-autopilothq

A php library for interacting with AutopilotHQ API http://docs.autopilot.apiary.io/#., (*1)

Installation

$ composer require picr/php-autopilothq

## Usage

All interaction occurs in the AutopilotManager class., (*2)

initialize manager

$manager = new AutopilotManager($apiKey);

getContact

$manager->getContact($id|$email);

saveContact

$manager->saveContact(AutopilotContact $contact);

saveContacts

$manager->saveContacts(array $contacts);

deleteContact

$manager->deleteContact($id|$email);

unsubscribeContact

$manager->unsubscribeContact($id|$email);

subscribeContact

$manager->subscribeContact($id|$email);

updateContactEmail

$manager->updateContactEmail($oldEmail, $newEmail);

getAllLists

$manager->getAllLists();

createList

$manager->createList($list);

getListByName

$manager->getListByName($list);

deleteList

//TODO: AutopilotHQ hasn't implemented this yet
$manager->deleteList($list);

getAllContactsInList

$manager->getAllContactsInList($list);

addContactToList

$manager->addContactToList($list, $id|$email);

removeContactFromList

$manager->removeContactFromList($list, $id|$email);

checkContactInList

$manager->checkContactInList($list, $id|$email);

allTriggers

$manager->allTriggers();

addContactToJourney

$manager->addContactToJourney($journey, $id|$email);

allRestHooks

$manager->allRestHooks();

deleteAllRestHooks

$manager->deleteAllRestHooks();

addRestHook

$manager->addRestHook($event, $targetUrl);

deleteRestHook

$manager->deleteRestHook($hookId);

## AutopilotContact

get value

// magic method
$value = $contact->$name;
// getter
$value = $contact->getFieldValue($name);

set value

// magic method
$contact->$name = $value;
// setter
$contact->setFieldValue($name, $value);

unset value

// magic method
unset($contact->$name);
// method
$contact->unsetFieldValue($name);

isset value

// magic method
isset($contact->$name);
// method
$contact->issetFieldValue($name);

getAllContactLists

//NOTE: this only reads cached "lists" array returned for a "contact info" request
$contact->getAllContactLists();

hasList

//NOTE: this only reads cached "lists" array returned for a "contact info" request
$contact->hasList($list);

fill

// read array of values and populate properties
// NOTE: automatically formats attributes according to AutopilotHQ's "naming convention" (doesn't really exist)
$contact->fill([
    'firstName' => 'John',
    'lastName'  => 'Smith',
    'age'       => 42,
]);

toRequest

// return array ready to be pushed to the API
$user = $contact->toRequest();

toArray

// return array of [ property => value ] no matter if custom or defined field
$user = $contact->toArray();
/* [
 *    'firstName' => 'John',
 *    'lastName'  => 'Smith',
 *    'age'       => 42,
 * ]
 */

jsonSerialize

// json representation of "toArray()"
$user = $contact->jsonSerialze();
$user = json_encode($contact);

License

MIT, (*3)

The Versions

31/05 2018

dev-master

9999999-dev https://github.com/finicprint/php-autopilothq

PHP wrapper for interacting with the AutopilotHQ API.

  Sources   Download

MIT

The Requires

 

The Development Requires

by John O

picr autopilothq autopilot

31/05 2018

v0.1.5

0.1.5.0 https://github.com/finicprint/php-autopilothq

PHP wrapper for interacting with the AutopilotHQ API.

  Sources   Download

MIT

The Requires

 

The Development Requires

by John O

picr autopilothq autopilot

10/01 2017

0.1.1

0.1.1.0 https://github.com/finicprint/php-autopilothq

PHP wrapper for interacting with the AutopilotHQ API.

  Sources   Download

MIT

The Requires

 

The Development Requires

by John O

picr autopilothq autopilot

25/02 2016

0.1.0

0.1.0.0 https://github.com/finicprint/php-autopilothq

PHP wrapper for interacting with the AutopilotHQ API.

  Sources   Download

MIT

The Requires

 

The Development Requires

by John O

picr autopilothq autopilot

25/02 2016

0.0.9

0.0.9.0 https://github.com/finicprint/php-autopilothq

PHP wrapper for interacting with the AutopilotHQ API.

  Sources   Download

MIT

The Requires

 

The Development Requires

by John O

picr autopilothq autopilot