1. Go to this page and download the library: Download sonnenglas/mydhl-php-sdk 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/ */
sonnenglas / mydhl-php-sdk example snippets
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();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.