PHPackages                             hotelbook/sdk - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. hotelbook/sdk

ActiveLibrary[API Development](/categories/api)

hotelbook/sdk
=============

Коннектор к хотелбуку

1.2.2(8y ago)716PHP

Since Dec 30Pushed 7y ago5 watchersCompare

[ Source](https://github.com/tmconsulting/hotelbook-sdk)[ Packagist](https://packagist.org/packages/hotelbook/sdk)[ RSS](/packages/hotelbook-sdk/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (4)Dependencies (11)Versions (13)Used By (0)

PHP Hotelbook SDK
-----------------

[](#php-hotelbook-sdk)

This SDK is used to connect to the hotelbook and use it methods for a 3-d party API.

- [Installation](#installation)
- [Get started](#get-started)
- [Api Reference](#api-reference)
- [Contact us](#contact-us)

### Installation

[](#installation)

```
composer require tmconsulting/hotelbook-php-sdk

```

### Get started

[](#get-started)

First of all, you will need to have credentials for the hotelbook.
The config with credentials looks like this.

```
$config = [
    'url' => 'https://hotelbook.pro/xml',
    'login' => 'YOUR LOGIN',
    'password' => 'YOUR PASSSWORD'
];
```

(if yoy pass anything not valid, it throws an exception while creating the main instance)

After that, include the library and create an basic instance of it.

```
//Require vendor
require __DIR__ . "/../vendor/autoload.php";

//Use main hotelbook class
use App\Hotelbook\Main;

//Create an instance of main class
$hotelbook = new Main($config);
```

Now you can use all the methods of the hotelbook sdk. For example:

E.g search for hotels:

```
use Carbon\Carbon;

$from = Carbon::parse('08-07-2018');
$till = Carbon::parse('09-07-2018');

$result = $hotelbook->search(1, $from, $till, [new SearchPassenger(1, [2])]);
```

Now the result will be an instance of ResultProceeder with all of the results

#### Handling errors and Proceeding results.

[](#handling-errors-and-proceeding-results)

If method has an error, it throws an exception that you can handle and than run getErrors the result.

```
try {
    $result = $main->book(...someArguments);
} catch (Exception $e)
{
    //Do something with the exception
}
```

Every method returns an object (if it doesn't throw an exception), that has to methods:

- getItems()
- getErrors()

`getItems` method returns all of the items returned from the method. `getErrors` method return all of the errors returned from hotelbook.

So that you can do something like:

```
//$result is a result of search request

if (!empty($result->getErrors()) {
 //Handle error
}

$items = $result->getItems();
//Do something with items.
```

### API Reference

[](#api-reference)

#### Meta Explanation

[](#meta-explanation)

All static data API $methods are available through `$main->{$YOUR_METHOD_NAME}`.
It gives an object with results (items, errors). (Described above.)

#### Available method

[](#available-method)

To use any of methods, you have to create an instance of HotelBook SDK. Described [here](#get-started)

Currently available methods:

- Search (Search for hotels)
- Async Search (Search for hotels in Asynchronous mode )
- Detail (Hotel Details)
- Book Order (Book a Hotel)
- Cancel Order (Cancel booking)
- Confirm Order (Confirm booking )
- Annulate Order (Cancel booking after confirm)

And methods to fetch dictionaries.

- [Country](#fetch-countries) - (Fetch all available countries)
- [City](#fetch-cities) - (Fetch all available Cities)
- Location - (Fetch all available Locations)
- Resort - (Fetch all available Resorts)
- HotelType - (Fetch all available Hotel Types)
- HotelCategory - (Fetch all available Hotel Categories)
- HotelFacility - (Fetch all available Hotel Facilities)
- HotelList- (Fetch all available Hotel Lists)
- Meal - (Fetch all available Meal Types)
- MealBreakfast - (Fetch all available Meal Breakfast Types)
- RoomSize - (Fetch all available Room Sizes)
- RoomType - (Fetch all available Room Types)
- RoomAmenity - (Fetch all available Room Amenities)
- RoomView - (Fetch all available Room Views)
- CurrencyRate - (Fetch currancy rates)

##### Fetch Countries

[](#fetch-countries)

###### Meta-explanation

[](#meta-explanation-1)

Fetch countries method is used to fetch all of the countries exist in the hotelbook database. So you can use it as a search parameter, etc...

###### Basic example

[](#basic-example)

```
//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.
```

##### Fetch Cities

[](#fetch-cities)

###### Meta-explanation

[](#meta-explanation-2)

Fetch cities is used to make search more deeper, so you can use it as a search parameter. Also, you can search cities by a country (So you fetch all the cities in a country.)

###### Basic examples

[](#basic-examples)

Fetch all cities exist in the Database.

```
$cities = $main->city();
$citiesArray = $cities->getItems();
```

Fetch all cities by country.

```
//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();
```

### Contact us.

[](#contact-us)

If you have any issues or questions regarding the API or the SDK it self, you are welcome to create an issue, or You can write an Email to `shatilo.reymond@gmail.com` or `roquie0@gmail.com`

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity70

Established project with proven stability

 Bus Factor1

Top contributor holds 78.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~11 days

Recently: every ~3 days

Total

11

Last Release

2945d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/35d8eff4a3e66b58f3e2af56fe948035469de1e19ac29c532d65c681955bbd18?d=identicon)[Roquie](/maintainers/Roquie)

---

Top Contributors

[![invasioncredible](https://avatars.githubusercontent.com/u/15307807?v=4)](https://github.com/invasioncredible "invasioncredible (22 commits)")[![roquie](https://avatars.githubusercontent.com/u/3214290?v=4)](https://github.com/roquie "roquie (6 commits)")

---

Tags

continuous-integrationhotelbookhotelsreservationsdktests

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/hotelbook-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/hotelbook-sdk/health.svg)](https://phpackages.com/packages/hotelbook-sdk)
```

###  Alternatives

[laravel/framework

The Laravel Framework.

34.6k509.9M17.0k](/packages/laravel-framework)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[team-reflex/discord-php

An unofficial API to interact with the voice and text service Discord.

1.1k379.4k24](/packages/team-reflex-discord-php)[wheelpros/fitment-platform-api

Magento 2 (Open Source)

12.1k1.2k](/packages/wheelpros-fitment-platform-api)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
