temmel/dhlpackageapi

DHL Package API client for PHP

Maintainers

Package info

github.com/ma-temmel/DHLPackageAPI

pkg:composer/temmel/dhlpackageapi

Statistics

Installs: 3

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

V0.1.3 2025-08-22 14:53 UTC

This package is auto-updated.

Last update: 2026-03-22 16:22:28 UTC


README

Contributors Forks Stargazers Issues project_license


DHL Package API

This is a Composer package to handle the DHL Post & Parcel Germany, Parcel API and the DHL Shipment Tracking - Unified API
Explore the docs »
Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. License
  4. Acknowledgments

About The Project

This is a Composer Package to handle most of the tasks on the DHL API to send packages and track its whereabouts. Initially only created for our own needs, but why not release it. I could not find anything like this. so here you have it... use it like you want.

I used mvdnbrk/dhlparcel-php-api as my basis and changed some stuff and build my own version.

This Package uses and older version of "collection" to ensure backwards-compatibility. Maybe some time in the future I will upgrade it. We will see.

(back to top)

Getting Started

It's a composer package.. what else to say?

Installation & Usage

  1. Get a API Key at https://developer.dhl.com

  2. Install per composer

    composer require mvdnbrk/dhlparcel-php-api
  3. Enter your API, create a package and send it to DHL

     require __DIR__ . '/vendor/autoload.php';
     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);
  4. Manifest

    $manifests = $dhlparcel->shipments->manifest(['profile' => 'STANDARD_GRUPPENPROFIL', 'billingNumber' => 'YOUR-BILLING-NUMER', 'shipmentNumbers' => [$shipment->shipmentNo]]);
  5. Tracking (This will not work directly after creating the shipping, you must manifest the shipping (or wait till the next day) and then wait another half an hour.)

    $tracking = $dhlparcel->tracking->get($shipment->shipmentNo);

(back to top)

License

Distributed under the project_license. See LICENSE.MD for more information.

(back to top)

Acknowledgments

(back to top)