定制 picr/php-autopilothq 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

picr/php-autopilothq

最新稳定版本:v0.1.5

Composer 安装命令:

composer require picr/php-autopilothq

包简介

PHP wrapper for interacting with the AutopilotHQ API.

README 文档

README

A php library for interacting with AutopilotHQ API http://docs.autopilot.apiary.io/#.

Installation

$ composer require picr/php-autopilothq

Usage

All interaction occurs in the AutopilotManager class.

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

统计信息

  • 总下载量: 146.31k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 11
  • 点击次数: 1
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 11
  • Watchers: 5
  • Forks: 21
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-02-25