1. Go to this page and download the library: Download temmel/dhlpackageapi 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/ */
temmel / dhlpackageapi example snippets
use Temmel\DHLPackageAPI\Client;
$dhlparcel = new Client($debug = false);
$dhlparcel->setUserName('USER-NAME');
$dhlparcel->setUserPassword('USER-PASSWORD');
$dhlparcel->setClientID('CLIENT-ID');
$dhlparcel->setClientSecret('CLIENT-SECRET');
$package_data = [
'profile' => 'STANDARD_GRUPPENPROFIL',
'product' => '',
'refNo' => '',
'billingNumber' => 'YOUR-BILLING-NUMGER',
'sender' => [
'shipperRef' => 'YOUR-OWN-SHIPPERREF-IF-EXISTS',
],
'recipient' => [
'name1' => 'NAME',
'contactName' => 'CONTACTNAME',
'addressStreet' => 'STREET (AND NUMBER)',
'addressHouse' => 'NUMBER IF NOT IN STREET',
'number_suffix' => '',
'postalCode' => 'POSTALCODE',
'city' => 'CITY',
'country' => 'COUNTRY (3 LETTERS)',
'email' => 'E-MAIL',
],
'sender' => [
'name1' => 'NAME',
'addressStreet' => 'STREET (AND NUMBER)',
'addressHouse' => 'NUMBER IF NOT IN STREET',
'additional_address_line' => '',
'postalCode' => 'POSTALCODE',
'city' => 'CITY',
'country' => 'COUNTRY (3 LETTERS)',
'email' => 'E-MAIL'
]
];
$package = new Package($package_data);
// THIS OPTIONS ARE ALREADY THE STANDARD, CHANGE IF NEEDED
$package->options->details = [
'dim' => [
'uom' => 'mm',
'height' => '100',
'width' => '150',
'length' => '200',
],
'weight' => [
'uom' => 'g',
'value' => 500,
],
];
$shipment = $dhlparcel->shipments->create($package);
// LOOK UP WHAT YOU NEED ;)
dump($shipment);