Created
June 12, 2015 09:55
-
-
Save iaintshine/fc8406765626d37063f6 to your computer and use it in GitHub Desktop.
Sample usage of Base CRM high-level Sync API wrapper
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require 'vendor/autoload.php'; | |
function getAccessToken() | |
{ | |
$token = getenv("BASECRM_ACCESS_TOKEN"); | |
if (!$token) throw new Exception('"BASECRM_ACCESS_TOKEN" environment variable has not been found'); | |
return $token; | |
} | |
function getDeviceUUID() | |
{ | |
$deviceUUID = getenv("BASECRM_DEVICE_UUID"); | |
if (!$deviceUUID) throw new Exception('"BASECRM_DEVICE_UUID" environment variable has not been found'); | |
return $deviceUUID; | |
} | |
$client = new \BaseCRM\Client([ | |
'accessToken' => getAccessToken(), | |
'verbose' => true | |
]); | |
$sync = new \BaseCRM\Sync($client, getDeviceUUID()); | |
$sync->fetch(function ($meta, $resource) { | |
print_r($meta); | |
print_r($resource); | |
return \BaseCRM\Sync::ACK; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment