PHP code example of digitalbrands / booking-com-sdk

1. Go to this page and download the library: Download digitalbrands/booking-com-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/ */

    

digitalbrands / booking-com-sdk example snippets



$client = Client::create([
    'login' => 'your_login',
    'password' => 'your_password',
    'timeout' => 5, // Optional
    'v' => '2.2' // Optional
]);

$models = $client->autocomplete(new AutocompleteQuery('test'));

foreach ($models as $model){
    print $model->getId();
    print $model->getName();
    // etc
}

$models = $client->getChainTypes((new ChainTypesQuery());

foreach ($models as $model){
    print $model->getId();
    print $model->getName();
    // etc
}

$sinceDate=new \DateTime();
$model = $client->getChangedHotelsInfo(new ChangedHotelsQuery($sinceDate));

//Closed hotels
$model->getClosedHotels();

//Changed hotels
$model->getChangedHotels();


$models = $client->getCities((new CitiesQuery()));

foreach ($models as $model){
    print $model->getId();
    print $model->getName();
    // etc
}


$models = $client->getCountries((new CountriesQuery()));

foreach ($models as $model){
    print $model->getId();
    print $model->getName();
    // etc
}


$models = $client->getDistricts((new DistrictsQuery()));

foreach ($models as $model){
    print $model->getId();
    print $model->getName();
    // etc
}


$models = $client->getFacilityTypes((new FacilityTypesQuery()));

foreach ($models as $model){
    print $model->getId();
    print $model->getName();
    // etc
}


$models = $client->getHotelFacilityTypes((new HotelFacilityTypesQuery()));

foreach ($models as $model){
    print $model->getId();
    print $model->getName();
    // etc
}


$models = $client->getHotels((new HotelsQuery()));

foreach ($models as $model){
    print $model->getId();
    print $model->getInfo();
    // etc
}


$models = $client->getHotelThemeTypes((new HotelThemeTypesQuery()));

foreach ($models as $model){
    print $model->getId();
    print $model->getName();
    // etc
}


$models = $client->getHotelTypes((new HotelTypesQuery()));

foreach ($models as $model){
    print $model->getId();
    print $model->getName();
    // etc
}


$models = $client->getPaymentTypes((new PaymentTypesQuery()));

foreach ($models as $model){
    print $model->getId();
    print $model->getName();
    // etc
}


$models = $client->getRegions((new RegionsQuery()));

foreach ($models as $model){
    print $model->getId();
    print $model->getName();
    // etc
}


$models = $client->getRoomFacilityTypes((new RoomFacilityTypesQuery()));

foreach ($models as $model){
    print $model->getId();
    print $model->getName();
    // etc
}

$models = $client->getRoomTypes((new RoomTypesQuery()));

foreach ($models as $model){
    print $model->getId();
    print $model->getName();
    // etc
}