PHP code example of tmconsulting / hotelbook-php-sdk
1. Go to this page and download the library: Download tmconsulting/hotelbook-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/ */
try {
$result = $main->book(...someArguments);
} catch (Exception $e)
{
//Do something with the exception
}
//$result is a result of search request
if (!empty($result->getErrors()) {
//Handle error
}
$items = $result->getItems();
//Do something with items.
//You already have an instance of SDK, and it's stored in $main
$countries = $main->country();
//Now, in countries, you have a simple result.
$countiesArray = $countries->getItems();
//Now in $countiesArray you have an array of Countries.
//Get first country item from the DB.
$country = current($main->country()->getItems());
//Find all cities there.
$cities = $main->city($country);
//Get all available items.
$citiesArray = $cities->getItems();
composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.