Package to work with the DHL Express Rest API (v2). This package is currently in development.
You can install the package via composer:
composer require booni3/dhl-express-rest
$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
Additional details needed
Note: setting the DDP account number, automatically sets the shipment up for DDP (delivery duty paid). Leave this blank/null to send DAP.
$dto->setCustomsDeclarable($declerable = true, $paperless = true, $ddpAccountNumber = 12345678);
$dto->setInvoice('PS-1234', now(), 'Adam Lambert');
$dto->setExportDeclaration('sale', 'GBP');
$dto->addExportLineItem(new LineItem('Red Jumper', 12.99, 1, 12456, 'GB', 12));
$dto->addExportLineItem(new LineItem('Blue Jumper', 12.99, 1, 12456, 'GB', 12));
composer test
Please see CHANGELOG for more information what has changed recently.
Please see CONTRIBUTING for details.
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.