PHPackages                             tcgunel/omniship-dhl-express - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. tcgunel/omniship-dhl-express

ActiveLibrary[API Development](/categories/api)

tcgunel/omniship-dhl-express
============================

DHL Express (MyDHL API) carrier for Omniship shipping library

v0.0.2(2mo ago)03↓100%MITPHPPHP ^8.2

Since Mar 12Pushed 2mo agoCompare

[ Source](https://github.com/tcgunel/omniship-dhl-express)[ Packagist](https://packagist.org/packages/tcgunel/omniship-dhl-express)[ RSS](/packages/tcgunel-omniship-dhl-express/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (5)Versions (3)Used By (0)

Omniship DHL Express
====================

[](#omniship-dhl-express)

DHL Express (MyDHL API) carrier driver for the Omniship multi-carrier shipping library.

Installation
------------

[](#installation)

```
composer require tcgunel/omniship-dhl-express
```

Usage
-----

[](#usage)

```
use Omniship\Omniship;
use Omniship\Common\Address;
use Omniship\Common\Package;

$dhl = Omniship::create('DHL_Express');
$dhl->initialize([
    'username' => 'your-api-key',       // MyDHL API Key
    'password' => 'your-api-secret',    // MyDHL API Secret
    'accountNumber' => '123456789',     // DHL account number (9-10 digits)
    'testMode' => true,
]);
```

### Create Shipment

[](#create-shipment)

```
$response = $dhl->createShipment([
    'shipFrom' => new Address(
        name: 'Ahmet Yilmaz',
        company: 'Sender Company',
        street1: 'Ataturk Cad. No:42',
        city: 'Istanbul',
        district: 'Kadikoy',
        postalCode: '34710',
        country: 'TR',
        phone: '+905551234567',
        email: 'sender@example.com',
        taxId: 'TR1234567890',
    ),
    'shipTo' => new Address(
        name: 'John Smith',
        company: 'Receiver Inc',
        street1: '123 Main Street',
        street2: 'Suite 100',
        city: 'New York',
        state: 'NY',
        postalCode: '10001',
        country: 'US',
        phone: '+12125551234',
        email: 'receiver@example.com',
    ),
    'packages' => [
        new Package(weight: 2.5, length: 30, width: 20, height: 15, description: 'Electronics'),
    ],
    'productCode' => 'P',                  // Express Worldwide (default)
    'plannedShippingDate' => '2026-03-13T10:00:00GMT+03:00',
    // 'pickupRequested' => false,          // default
    // 'isCustomsDeclarable' => true,       // auto-detected from countries
    // 'declaredValue' => 150.00,
    // 'declaredValueCurrency' => 'USD',
    // 'labelFormat' => 'pdf',             // pdf, zpl, epl (default: pdf)
])->send();

if ($response->isSuccessful()) {
    echo $response->getTrackingNumber();                // "1234567890"
    echo $response->getDispatchConfirmationNumber();    // needed for cancellation
    echo $response->getTrackingUrl();                   // DHL tracking page URL
    echo $response->getEstimatedDeliveryDate();         // "2026-03-16"

    $label = $response->getLabel();
    if ($label !== null) {
        file_put_contents('label.pdf', base64_decode($label->content));
    }
}
```

### Track Shipment

[](#track-shipment)

```
$response = $dhl->getTrackingStatus([
    'trackingNumber' => '1234567890',
])->send();

if ($response->isSuccessful()) {
    $info = $response->getTrackingInfo();
    echo $info->status->value;           // "delivered", "in_transit", etc.
    echo $info->trackingNumber;          // AWB number
    echo $info->carrier;                 // "DHL Express"
    echo $info->serviceName;             // "Express Worldwide"
    echo $info->signedBy;                // "J.SMITH" (if delivered)

    foreach ($info->events as $event) {
        echo $event->description;        // "Arrived at DHL Sort Facility"
        echo $event->city;               // "NEW YORK"
        echo $event->country;            // "USA"
        echo $event->occurredAt->format('Y-m-d H:i');
    }
}
```

### Cancel Shipment

[](#cancel-shipment)

Cancels the pickup associated with a shipment. The `dispatchConfirmationNumber` from the create response is required.

```
$response = $dhl->cancelShipment([
    'trackingNumber' => '1234567890',
    'dispatchConfirmationNumber' => 'DHL-DC-123456',
    // 'requestorName' => 'Ahmet Yilmaz',
    // 'cancelReason' => '006',  // default: '008' (Other)
])->send();

if ($response->isCancelled()) {
    echo 'Pickup cancelled';
}
```

### Get Rates

[](#get-rates)

```
$response = $dhl->getRates([
    'shipFrom' => new Address(
        city: 'Istanbul',
        postalCode: '34710',
        country: 'TR',
    ),
    'shipTo' => new Address(
        city: 'New York',
        postalCode: '10001',
        country: 'US',
    ),
    'packages' => [
        new Package(weight: 2.5, length: 30, width: 20, height: 15),
    ],
    'plannedShippingDate' => '2026-03-13',
    'isCustomsDeclarable' => true,
    // 'productCode' => 'P',    // omit to get all available products
])->send();

if ($response->isSuccessful()) {
    foreach ($response->getRates() as $rate) {
        echo $rate['productCode'];       // "P"
        echo $rate['productName'];       // "EXPRESS WORLDWIDE"
        echo $rate['price'];             // 85.50 (billing currency)
        echo $rate['currency'];          // "USD"
        echo $rate['transitDays'];       // 3
        echo $rate['estimatedDelivery']; // "2026-03-16T23:59:00"
    }
}
```

Product Codes
-------------

[](#product-codes)

CodeProductType`P`Express WorldwideNon-document`D`Express WorldwideDocument`U`Express Worldwide (EU)Non-document`K`Express 9:00Non-document`T`Express 12:00Non-document`N`Domestic ExpressNon-document`H`Economy SelectNon-document`G`Express Worldwide (B2C)Non-documentTracking Status Mapping
-----------------------

[](#tracking-status-mapping)

DHL EventDescriptionShipmentStatus`TP`Shipment data received`PRE_TRANSIT``PU`Picked up`PICKED_UP``PL/DF/AF/CC/CR/CI`In transit events`IN_TRANSIT``WC`With delivery courier`OUT_FOR_DELIVERY``OK/DL/DD`Delivered`DELIVERED``NH/BA/MS/OH`Delivery failure`FAILURE``RR/RT`Returned to shipper`RETURNED`Cancel Reason Codes
-------------------

[](#cancel-reason-codes)

CodeDescription`001`Package not ready`002`Rates too high`003`Transit time too long`006`Shipment cancelled by customer`008`Other (default)API Details
-----------

[](#api-details)

- **Transport**: REST/JSON via PSR-18 HTTP client
- **Auth**: HTTP Basic Authentication (API Key + API Secret)
- **Base URL**: `https://express.api.dhl.com/mydhlapi/`
- **Test URL**: `https://express.api.dhl.com/mydhlapi/test/`
- **Create**: `POST /shipments` — returns tracking number + base64 labels
- **Track**: `GET /tracking?shipmentTrackingNumber={number}` — returns events with type codes
- **Cancel**: `DELETE /shipments/{trackingNumber}/pickup` — cancels pickup (not label void)
- **Rates**: `GET /rates` — returns available products with pricing

> **Note:** DHL Express does not provide a label-voiding endpoint. The cancel operation cancels the associated pickup request.

Testing
-------

[](#testing)

```
docker compose run --rm php bash -c "cd omniship-dhl-express && vendor/bin/pest"
```

License
-------

[](#license)

MIT

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance88

Actively maintained with recent releases

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

60d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/36dffe883e88aeef07c26067af3d6a7eda1c2a81f1ae45fdd430b721665131da?d=identicon)[Mobius Studio](/maintainers/Mobius%20Studio)

---

Top Contributors

[![tcgunel](https://avatars.githubusercontent.com/u/3923425?v=4)](https://github.com/tcgunel "tcgunel (2 commits)")

###  Code Quality

TestsPest

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/tcgunel-omniship-dhl-express/health.svg)

```
[![Health](https://phpackages.com/badges/tcgunel-omniship-dhl-express/health.svg)](https://phpackages.com/packages/tcgunel-omniship-dhl-express)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
