2017 © Pedro Peláez
 

library infusionsoft-sync

image

wildsurfer/infusionsoft-sync

  • Thursday, November 27, 2014
  • by wildsurfer
  • Repository
  • 1 Watchers
  • 4 Stars
  • 25 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

Infusionsoft sync

Use this library to add two-way syncing between your application and Infusionsoft CRM., (*1)

Features

  • Configure field names
  • Using custom field names if necessary
  • Configure tag names
  • Optimized to work with big data sets

How it works

This library realizes 2 methods to help to sync your application with Infusionsoft API: pull() and push(), (*2)

pull() goes to remote API, fetches all contacts and returns them to you. You can then use this data to sync it with your application storage, (*3)

push() will allow you to put your local users to remote. This method is smart enought to update contacts if they're already present at Infusionsoft and to skip if nothing was changed., (*4)

Under the hood there is a pull() method call inside the push() method. This is done to minify amount of API calls and to speed-up the process on big data sets. However when you push one contact pull() is skipped to prevent redundancy., (*5)

Examples

To get list of contacts from Infusionsoft API, (*6)

``` php <?php use Wildsurfer\Infusionsoft;, (*7)

$options = array( 'appname' => 'myappname', 'apikey' => 'asdU234YGUYG1234gjhg', 'tags' => array( '1', '2', '3' ), 'fields' = array( 'Email', 'FirstName', 'LastName' ) );, (*8)

$sync = new Sync($options);, (*9)

$infusionsoftContacts = $sync->pull();, (*10)


To push your application users to Infusionsoft API ``` php <?php $myUsers = ... // Fetch data from your storage $toBeSyncedUsers = new ContactCollection(); foreach($myUsers as $user) { $array = someFunctionToMapYourFieldNamesToInfusionsoftFieldNames($user); $toBeSyncedUsers->create(new Contact($array)); } $result = $sync->push($toBeSyncedUsers); $created = $result['create']->read(); // Array of created contacts $updated = $result['update']->read(); // Array of updated contacts $failed = $result['fail']->read(); // Array of failed contacts $skipped = $result['skip']->read(); // Array of skipped contacts

Displaying errors, (*11)

<?php

$result = $sync->push(...);

$failed = $result['fail']; // Array of failed contacts

if ($failed->count() > 0) {
    foreach ($failed->read() as $f) {
        echo $f->getErrorMessage();
    }
}

Install with Composer

``` js { require: { "wildsurfer/infusionsoft": "dev-master" } }, (*12)


Running tests ============= Tests that written for this library are splitted in two testsuites: `unit` and `functional`. To run functional tests you will need to setup Infusionsoft sandbox account and find your `appname` and `apikey`. More info: https://developer.infusionsoft.com/sandbox_application http://ug.infusionsoft.com/article/AA-00442/0/Infusionsoft-API-Key.html ```bash $ cp infusionsoft.ini.dist infusionsoft.ini $ vim infusionsoft.ini

The Versions

27/11 2014

dev-master

9999999-dev

  Sources   Download

MIT

The Requires

 

The Development Requires

by Ivan Kuznetsov

infusionsoft isdk

27/11 2014

v0.2.1

0.2.1.0

  Sources   Download

MIT

The Requires

 

The Development Requires

by Ivan Kuznetsov

infusionsoft isdk

24/09 2014

v0.2

0.2.0.0

  Sources   Download

MIT

The Requires

 

The Development Requires

by Ivan Kuznetsov

infusionsoft isdk

02/09 2014

v0.1

0.1.0.0

  Sources   Download

MIT

The Requires

 

The Development Requires

by Ivan Kuznetsov

infusionsoft isdk