2017 © Pedro Peláez
 

library php-relateiq

PHP RelateIQ API

image

nathanabrewer/php-relateiq

PHP RelateIQ API

  • Tuesday, March 8, 2016
  • by nathanabrewer
  • Repository
  • 1 Watchers
  • 1 Stars
  • 296 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

OBSOLETE - php-relateiq

Simple class to quickly read and write stuff in RelateIQ. I do not have anything that is in place for Accounts at this moment, only simple Contact and List/ListItem stuff., (*1)

Install with composer, (*2)

"require": {
        "nathanabrewer/php-relateiq": "0.0.*"
}

Using Laravel4? Me too! ....In you config/app.php add to your aliases array, (*3)

'RelateIQ'          =>  '\nathanabrewer\RelateIQ\RelateIQ'

Example below will run two API Queries, one GET and one PUT., (*4)

$riq = new RelateIQ($key, $secret);
$contact = $riq->getContact('53c238d7e4b0d0612a7b84bd');
$contact->properties->remove('email', 'nathan.a.brewer@gmail.com');
$contact->properties->add('email', 'nathan.a.brewer@dftz.org');
$contact->save();

Lookup the available Lists... Make sure the List is shared with you! This will runs a single GET Request, (*5)

$lists = $riq->getLists();
foreach($lists as $list){
    echo "{$list->id} -- {$list->title}\n";
}

Here, Rather than look at all the Lists, I am asking each List for List Items that contain this Contact. This will do a series of API GET requests: 1. A GET Request for all avaliable Lists (If I have not done one yet) 2. A GET Request per List for all ListItems with contact, (*6)

$listItems = $riq->getAllListItemsForContact($contact);
foreach($listItems as $listItem){
    echo "Contact {$contact->getName()} (cid {$contact->id} has a ListItem {$listItem->id} on List {$listItem->listId} {$listItem->getList()->title}\n";
}

Alternatively, I could load the List, and then load the List Item. If I load an existing ListItem by its ListItem Id then we don't need to deal with the contactID, (*7)

$list = $riq->getList($list_id);
$listItem = $list->getListItem($list_item_id);

Here I am interacting with my List Item. The idea here is already have the List Schema loaded, so I can define a value by its name. I will let the ListItem object determine if it is a Text/Number/List or Picklist, and set the value for the API call as appropriate., (*8)

$listItem->setField('Status', 'Active');
$listItem->setField('Drinks', array('Tea', 'Coffee', 'Water'));
$listItem->save();

The Versions

08/03 2016

dev-master

9999999-dev

PHP RelateIQ API

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by Nathan Brewer

relateiq

16/07 2014

0.0.1

0.0.1.0

PHP RelateIQ API

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by Nathan Brewer

relateiq

15/07 2014

0.0.1-alpha

0.0.1.0-alpha

PHP RelateIQ API

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by Nathan Brewer

relateiq