1. Go to this page and download the library: Download kitdelivery/sdk-kit-api 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/ */
namespace Test;
use service\KitAPI\Factory\SimpleClientFactory;
use service\KitAPI\Interfaces\ApiExceptionInterface;
use service\KitAPI\Interfaces\ClientExceptionInterface;
onInterface $exception) {
echo $exception;
exit(-1);
}
foreach ($response->countries as $country) {
printf("Название страны - '%s'. Код страны - '%s'", $country->name, $country->code);
echo PHP_EOL;
}
namespace Test;
use service\KitAPI\Factory\SimpleClientFactory;
use service\KitAPI\Interfaces\ApiExceptionInterface;
use service\KitAPI\Interfaces\ClientExceptionInterface;
use service\KitAPI\Model\Entity\Geography\Phone;
use service\KitAPI\Model\Request\Geography\GetListAddressRequest;
oreach ($response->addreses as $address) {
printf("ID адреса - %d. Адрес терминала - %s. ", $address->id, $address->value);
if ($address->phone) {
echo PHP_EOL;
/** @var Phone $value */
foreach ($address->phone as $value) {
printf("Номер телефона - %s", $value->value);
echo PHP_EOL;
}
echo PHP_EOL;
}
}