holidaylink/api-sdk-php

HolidayLink.com PHP SDK for API

dev-master 2017-03-07 10:01 UTC

This package is auto-updated.

Last update: 2024-10-27 06:23:32 UTC


README

This repository contains Holiday-Link.com PHP SDK and samples for our API

Prerequisites

  • PHP 5.3 or above
  • curl extension must be enabled
  • json extension must be enabled
  • composer for fetching dependencies (See http://getcomposer.org)

Samples

Usage

To write an app that uses the SDK

  • add holidalink/api-sdk-php to your composer.json require list or copy the [sample/composer.json] (sample/composer.json) to your project's root
  • run composer update to fetch dependencies
  • obtain API credentials from Holiday-Link.com
  • now you are all set to make your first API call
$apiCredentials = new \HolidayLink\Auth\Credentials($config['access-token]);

try {
    $params = array(
      'expand' => 'field1, field2, field3',
    );
    $entity = Entity::allFromXML($params, $apiCredentials);
} catch (Exception $ex) {
    echo 'Exception:', $ex->getMessage(), PHP_EOL;
    exit(1);
}

print_r($entity->toArray());