PHP code example of kangaroorewards / kangaroorewards-php-sdk

1. Go to this page and download the library: Download kangaroorewards/kangaroorewards-php-sdk library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

kangaroorewards / kangaroorewards-php-sdk example snippets


use KangarooRewards\Api\KangarooApi;

$api = new KangarooApi([
    'access_token' => $accessToken,
]);

$resourceOwner = $api->me();

$customer = $api->getCustomer($customerId, ['

$api = new KangarooApi([
    'access_token' => $accessToken,
    'base_api_url' => 'https://api.kangaroorewards.com',
    'user_agent'   => 'My App/1.0',
    'headers'      => ['X-Application-Key' => $applicationKey],
]);

$api->me($options);
$api->getCustomers($options);
$api->getCustomer($id, $options);
$api->createCustomer($data);
$api->updateCustomer($id, $data);
$api->getCustomerTransactions($id, $options);
$api->getCustomerNotifications($id, $options);
$api->getBranches($options);
$api->getOffers($options);
$api->getProducts($options);

use KangarooRewards\Api\Exception\ExceptionInterface as KangarooException;

try {
    $customer = $api->getCustomer($customerId);
} catch (KangarooException $e) {
    // SDK-level failure
} catch (\GuzzleHttp\Exception\RequestException $e) {
    // Transport / HTTP status failure
}

use GuzzleHttp\Client;

$api = new KangarooApi([
    'access_token' => $accessToken,
    'http_client'  => new Client(['timeout' => 5.0]),
]);
bash
composer