1. Go to this page and download the library: Download booni3/dhl-express-rest 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/ */
booni3 / dhl-express-rest example snippets
$dto = new ShipmentCreator();
$dto->setShipperAccountNumber(954103895);
$dto->setShipper(
(new CustomerDetails('John Smith','21 Apple Drive','Malmesbury','Wiltshire',
'Malmesbury','SN16 4TB','GB','My Awesome Company','071111111112','[email protected]',
))
->addVat('GB1234')
->addEORI('GB1234')
);
$dto->setProductCode('N'); // GB
$dto->setReceiver(new Address('Helen Jones', '4 Drive', 'London', 'E14 8DW', 'GB'));
$dto->addReference('123456-custom-ref');
$dto->addPackage(new Package(12.5, 20, 10, 10, 'Jumpers', 'order-ref-1244'));
$dhl = DHL::make([
'user' => 'DHLUSER',
'pass' => 'dsdfsedf',
'sandbox' => true, // false or remove for production
]);
$res = $dhl->shipments()->create($dto);
$res->trackingUrl; // tracking number
$res->trackingNumber; // url for api tracking
$res->labelData(); // decoded label data