use Bookingcom\Client\Client;
use Bookingcom\Client\Result\ChangedHotels;
$client = new Client('<username>', '<password>');
$client->getChangedHotels('-2 hours')->then(function (ChangedHotels $changedHotels) {
foreach ($changedHotels->getClosedHotelIds() as $hotelId) {
// do something
}
// or
foreach ($changedHotels->getChanges() as $hotelId => $changes) {
// do something
}
})->wait();
To send multiple requests asynchronously:
use GuzzleHttp\Promise;
use Bookingcom\Client\Client;
$client = new Client('<username>', '<password>');
$results = Promise\all([
'descriptions' => $client->getHotelDescriptions(42, ['en', 'nl']),
'facilities' => $client->getHotelFacilities(42, ['en', 'nl']),
])->wait();
foreach ($results as $type => $result) {
// ...
}
Before running tests, copy phpunit.xml.dist to phpunit.xml
and set BOOKINGCOM_API_USERNAME
and BOOKINGCOM_API_PASSWORD
environment variables.
Then run the tests:
vendor/bin/phpunit
The library is released under the MIT License. See the bundled LICENSE file for details.