PHP code example of dhl / sdk-api-parcel-management
1. Go to this page and download the library: Download dhl/sdk-api-parcel-management 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/ */
dhl / sdk-api-parcel-management example snippets
$serviceFactory = new \Dhl\Sdk\Paket\ParcelManagement\Service\ServiceFactory();
$service = $serviceFactory->createCheckoutService(
$applicationId = '4pp-1D',
$applicationToken = '4pp-t0k3N',
$ekp = '1234567890',
$logger = new \Psr\Log\NullLogger(),
$sandbox = true
);
$carrierServices = $service->getCarrierServices($postalCode = '12345', $dropOffDate = new \DateTime('2038-01-19'));
// process response as desired:
$getAvailableServices = function (
array $availableServices,
\Dhl\Sdk\Paket\ParcelManagement\Api\Data\CarrierServiceInterface $carrierService
) {
if ($carrierService->isAvailable()) {
$availableServices[$carrierService->getCode()] = $carrierService;
}
return $availableServices;
};
$availableServices = array_reduce($carrierServices, $getAvailableServices, []);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.