PHP library for using DHL Express REST API (MyDHL API).
Note: It supports only the latest REST API provided by DHL. No SOAP API support.
| Service | Supported |
|---|---|
| RATING | |
| Retrieve Rates for a one piece Shipment | ✅ |
| Retrieve Rates for Multi-piece Shipments | ❌ |
| Landed Cost | ❌ |
| PRODUCT | |
| Retrieve DHL Express products | ❌ |
| SHIPMENT | |
| Electronic Proof of Delivery | ❌ |
| Upload updated customs docs for shipment | ❌ |
| Create Shipment | ✅ |
| Upload Commercial Invoice Data for shipment | ❌ |
| TRACKING | |
| Track a single DHL Express Shipment | ❌ |
| Tracka single or multiple DHL Express Shipments | ❌ |
| PICKUP | |
| Cancel a DHL Express pickup booking request | ❌ |
| Update pickup information for existing pickup booking req | ❌ |
| Create a DHL Express pickup booking request | ❌ |
| IDENTIFIER | |
| Service to allocate identifiers upfront ... | ❌ |
| ADDRESS | |
| Validate DHL Express pickup/delivery capability | ❌ |
| INVOICE | |
| Upload Commercial Invoice data | ❌ |
diff
use Sonnenglas\MyDHL\MyDHL;
use Sonnenglas\MyDHL\ValueObjects\RateAddress;
use Sonnenglas\MyDHL\ValueObjects\Package;
$testMode = true;
$myDhl = new MyDHL('username', 'password', $testMode);
$rateService = $myDhl->getRateService();
$originAddress = new RateAddress(
countryCode: 'DE',
postalCode: '10117',
cityName: 'Berlin',
);
$destinationAddress = new RateAddress(
countryCode: 'DE',
postalCode: '20099',
cityName: 'Hamburg',
);
$package = new Package(
weight: 10, // kg
height: 20, // cm
length: 10, // cm
width: 30, // cm
);
$shippingDate = new DateTimeImmutable('2021-01-15 12:00:00');
$rates = $rateService->setAccountNumber('99999999')
->setOriginAddress($originAddress)
->setDestinationAddress($destinationAddress)
->setPlannedShippingDate($shippingDate)
->setPackage($package)
->setNextBusinessDay(false)
->setCustomsDeclarable(false)
->getRates();All usage examples: