titravel/api-sdk-php

To Island Travel's PHP SDK for API

v0.2.14 2022-10-13 07:04 UTC

README

Latest Stable Version Total Downloads

This repository contains To Islands Travel's 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 titravel/api-sdk-php to your composer.json require list or copy the sample/composer.json to your project's root
  • run composer update --no-dev to fetch dependencies
  • obtain API credentials from To Islands Travel
  • now you are all set to make your first API call
$apiCredentials = new \TiTravel\Auth\Credentials($config['b2b'], $config['code']);

try {
    $params = array(
        'city_id' => null,
        'category_id' => null,
    );
    $properties = PropertiesInfo::all($params, $apiCredentials);
} catch (Exception $ex) {
    echo 'Exception:', $ex->getMessage(), PHP_EOL;
    exit(1);
}

print_r($properties->toArray());