Skip to content

DHL Driver

Back to the Core Drivers list

This is a driver for the DHL API. Check out the repository on GitHub for more information.

Installation

First, install the DHL driver via the Composer package manager:

shell
composer require parceltrap/driver-dhl
composer require parceltrap/driver-dhl

Configuration

In your config/parceltrap.php configuration file, add the following to the drivers key:

php
'dhl' => [
    'client_id' => env('PARCELTRAP_DHL_CLIENT_ID'),
],
'dhl' => [
    'client_id' => env('PARCELTRAP_DHL_CLIENT_ID'),
],

You can get these details by registering for the DHL API. To find out more, visit the Shipment Tracking API reference. This documentation page also shows the raw DHL-specific data that can be found in the returned TrackingDetails DTO.

Usage

php
$driver = \ParcelTrap\Facades\ParcelTrap::driver('dhl');

$driver->find('7777777770'); // ParcelTrap\DTOs\TrackingDetails
$driver = \ParcelTrap\Facades\ParcelTrap::driver('dhl');

$driver->find('7777777770'); // ParcelTrap\DTOs\TrackingDetails