1. Go to this page and download the library: Download xmlworld/api-client 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/ */
xmlworld / api-client example snippets
$xmlClient = new XMLClient(login: 'login', password: 'password');
$searchDetails = new SearchDetails(
arrivalDate: '2023-09-01', // arrival date
duration: 5, // duration in days
roomRequests: new RoomRequests( // list of rooms
RoomRequest::fromAges(2),
RoomRequest::fromAges(
1, // number of adults
16, // age of first child (variadic)
8, // age of second child
2 // age of third child
),
),
properties: new Properties(19, 21), // list of properties if searching for some
propertyID: null, // if only one we can use this param, but they exclude each other
mealBasisID: 0, // meal basis
minStarRating: 0, // filter by star rating
minimumPrice: 0, // filter by minimum price
maximumPrice: 0 // filter by max price
);
$myLogger = function($payload){
echo $payload;
};
//you can implement the Logger interface to inject your logging implementation in the client.
$logging = new class($myLogger) implements Logger
{
protected Closure $myLogger;
public function __construct(Closure $myLogger)
{
$this->myLogger = $myLogger;
}
public function logRequest(string $log): void
{
($this->myLogger)($log);
}
public function logResponse(int $statusCode, string $log): void
{
($this->myLogger)($log);
}
};
$xmlClient = new XMLClient(login: $login, password: $password, env: $env, logger: $logging);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.