2017 © Pedro Peláez
 

library apiclient

Tourboks API client for PHP

image

tourboks/apiclient

Tourboks API client for PHP

  • Thursday, July 19, 2018
  • by spyralehandr0s@gmail.com
  • Repository
  • 2 Watchers
  • 0 Stars
  • 13 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Latest Stable Version, (*1)

Tourboks API Client Library for PHP

Description

This repository contains the API client library that allows you to access the Tourboks platform from your PHP app., (*2)

Requirements

Installation

You can use Composer or simply Download the Release, (*3)

Composer

The preferred method is via composer. Follow the installation instructions if you do not already have composer installed., (*4)

Once composer is installed, execute the following command in your project root to install this library:, (*5)

composer require tourboks/apiclient

Finally, be sure to include the autoloader:, (*6)

require_once '/path/to/your-project/vendor/autoload.php';

Basic Example

<?php

require_once(dirname(__FILE__) . '/vendor/autoload.php');

// Note: Before go live change environment to LIVE
$config = new Tourboks\TourboksConfig([
    'member_username' => 'test',
    'member_password' => 'test',
    'environment' => 'STAGING',
]);

$requestParameters = [
    'product_id' => 23,
    'locale_id' => 1,
    'currency' => 'EUR',
];
$request = new Tourboks\Request\ProductDetails($requestParameters);
$request->setConfig($config);
try {
    $response = $request->perform();
    $data = $response->getData();
} catch (\Tourboks\Exceptions\TourboksResponseException $e) {
    $message = $e->getMessage();
}


$body = [
    'localeId' => '',
    'format' => '',
    'pageNumber' => 1,
    'keyword' => '',
    'category' => '',
    'sportTeam' => '',
    'dateFrom' => '',
    'dateTo' => '',
    'language' => '',
    'priceFrom' => '',
    'priceTo' => '',
    'durationFrom' => '',
    'durationTo' => '',
    'isBestSeller' => '',
    'meetTheLocals' => '',
    'distanceFrom' => '',
    'hasConfirmation' => '',
    'showTestProducts' => '',
];
$request = new Tourboks\Request\ProductSearch([], $body);
$request->setConfig($config);
try {
    $response = $request->perform();
    $data = $response->getData();
} catch (\Tourboks\Exceptions\TourboksResponseException $e) {
    $message = $e->getMessage();
}


$body = [
    'productId' => '23',
    'dateFrom' => '2018-08-12',
    'dateTo' => '2018-10-30'
];
$request = new Tourboks\Request\ProductAvailableDates([], $body);
$request->setConfig($config);
try {
    $response = $request->perform();
    $data = $response->getData();
} catch (\Tourboks\Exceptions\TourboksResponseException $e) {
    $message = $e->getMessage();
}

$body = [
    "productId" => "23",
    "date" => "2018-08-13",
    "currency" => "EUR",
    "persons" => [
        "personType" => "0",
        "numItems" => "2"
    ]
];
$request = new Tourboks\Request\ProductAvailability([], $body);
$request->setConfig($config);
try {
    $response = $request->perform();
    $data = $response->getData();
} catch (\Tourboks\Exceptions\TourboksResponseException $e) {
    $message = $e->getMessage();
}


$body = [
    "isInvoice" => 0,
    "addressAdditional" => "",
    "zip" => "10077",
    "title" => 0,
    "mytbIds" => "",
    "country" => 199,
    "currency" => "EUR",
    "city" => "Taipei ",
    "vat" => "",
    "activity" => "",
    "products" => [[
        "variantId" => "0",
        "extras" => [],
        "componentKey" => "",
        "id" => 23,
        "timeslots" => 14449,
        "personType" => [[
            "personType" => "0",
            "numItems" => "1"
        ]],
        "dateSelected" => "2018-08-13",
        "additionalInfo" => [[
            "id" => "",
            "bdate" => "",
            "name" => "",
            "hotel" => ""
        ]],
        "temporaryDate" => ""
    ]],
    "state" => " ",
    "localeId" => 2,
    "format" => "",
    "email" => "test@tourboks.com",
    "memberType" => 0,
    "phone" => "930666277",
    "companyName" => "",
    "firstName" => "Tsi Chao ",
    "remarks" => "",
    "memberId" => 321,
    "lastName" => "Yu",
    "address" => "Adress",
    "irs" => ""
];
$request = new Tourboks\Request\OrderCreate([], $body);
$request->setConfig($config);
try {
    $response = $request->perform();
    $data = $response->getData();
} catch (\Tourboks\Exceptions\TourboksResponseException $e) {
    $message = $e->getMessage();
}


$body = [
    "transactionToken" => 987,
    "transactionDate" => "2018-08-01",
];
$requestParameters = [
    'order_id' => 5495,
];
$request = new Tourboks\Request\OrderPay($requestParameters, $body);
$request->setConfig($config);
try {
    $response = $request->perform();
    $data = $response->getData();
} catch (\Tourboks\Exceptions\TourboksResponseException $e) {
    $message = $e->getMessage();
}


$body = [
    "currency" => 'EUR',
    "localeId" => 1,
    "format" => 1,
];
$request = new Tourboks\Request\MyOrders([], $body);
$request->setConfig($config);
try {
    $response = $request->perform();
    $data = $response->getData();
} catch (\Tourboks\Exceptions\TourboksResponseException $e) {
    $message = $e->getMessage();
}


The Versions

19/07 2018

dev-master

9999999-dev https://github.com/tourboks/apiclient

Tourboks API client for PHP

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

api client apiclient tourboks

19/07 2018

1.0

1.0.0.0 https://github.com/tourboks/apiclient

Tourboks API client for PHP

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

api client apiclient tourboks