PHPackages                             shipsa/dhl-sdk - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. shipsa/dhl-sdk

ActiveLibrary[HTTP &amp; Networking](/categories/http)

shipsa/dhl-sdk
==============

PHP and Laravel SDK for integrating DHL shipping services

v1.0.0(1mo ago)11↓50%MITPHP ^8.1

Since Jun 21Compare

[ Source](https://github.com/HusseinAhmed2018/shipsa-dhl-sdk)[ Packagist](https://packagist.org/packages/shipsa/dhl-sdk)[ RSS](/packages/shipsa-dhl-sdk/feed)WikiDiscussions Synced 2w ago

READMEChangelogDependencies (4)Versions (2)Used By (0)

Shipsa DHL SDK
==============

[](#shipsa-dhl-sdk)

A modern PHP SDK for the DHL Express API.

Features
--------

[](#features)

- ✅ Get shipping rates
- ✅ Create shipments
- ✅ Generate shipping labels
- ✅ Shipment tracking number and tracking URL
- ✅ Customs declaration support
- ✅ DTO-based requests
- ✅ Object-oriented responses
- ✅ PHP 8.1+

---

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

[](#installation)

```
composer require shipsa/dhl-sdk
```

---

Configuration
-------------

[](#configuration)

Add the following variables to your `.env` file:

```
DHL_API_KEY=your_api_key
DHL_API_SECRET=your_api_secret
DHL_TEST_MODE=true
```

Or define them in your config file:

```
return [
    'api_key' => env('DHL_API_KEY'),
    'api_secret' => env('DHL_API_SECRET'),
    'test_mode' => env(
        'DHL_TEST_MODE',
        true
    ),
];
```

---

Usage
-----

[](#usage)

```
use Shipsa\DhlSdk\DHL;

$dhl = new DHL(
    apiKey: env('DHL_API_KEY'),
    secret: env('DHL_API_SECRET'),
    sandbox: true
);
```

---

Get Rates
=========

[](#get-rates)

```
use Shipsa\DhlSdk\DTO\Address;
use Shipsa\DhlSdk\DTO\Package;

$origin = new Address(
    countryCode: $countryCode,
    cityName: $cityName,
    postalCode: $postalCode
);

$destination = new Address(
    countryCode: $countryCode,
    cityName: $cityName,
    postalCode: $postalCode
);

$package = new Package(
    weight: 1,
    length: 10,
    width: 5,
    height: 1
);

$rates = $dhl
    ->rate()
    ->setAccountNumber('123456789')
    ->setOriginAddress($origin)
    ->setDestinationAddress($destination)
    ->setPlannedShippingDate(new DateTimeImmutable())
    ->setPackage($package)
    ->setNextBusinessDay(true)
    ->setCustomsDeclarable(false)
    ->getRates();
```

### Example

[](#example)

```
foreach ($rates as $rate) {

    echo $rate->getProductName();

    echo $rate->getTotalPrice();

    echo $rate->getCurrency();

}

$bestRate = $rateService->getCheapestRate($currancy);

$estimatedDays = $bestRate->getEstimatedDays();
```

---

Create Shipment
===============

[](#create-shipment)

```
$accounts = [
            new Account(
                typeCode: 'shipper',
                number: config('services.dhl.account_number'),
            ),
        ];

$shipment = $dhl
    ->shipment()
    ->setPickup($pickup)
    ->setAccounts($accounts)
    ->setShipperDetails($shipperAddress, $shipperContact)
    ->setReceiverDetails($receiverAddress, $receiverContact)    ->setPackages($packages)
    ->setPackages($packages)
    ->setDescription($description)
    ->setIncoterm($incoterm)
    ->isCustomsDeclarable($isCustomsDeclarable)
    ->createShipment();
```

### Shipment Response

[](#shipment-response)

```
$shipment->getTrackingNumber();

$shipment->getDispatchConfirmationNumber();

$shipment->getTrackingUrl();

$shipment->getLabelPdf();

$shipment->getPackages();
```

---

Responses
=========

[](#responses)

RateResponse
------------

[](#rateresponse)

```
$rate->getProductName();

$rate->getProductCode();

$rate->getTotalPrice();

$rate->getCurrency();

$rate->getEstimatedDeliveryDateAndTime();

$rate->getPricingDate();
```

ShipmentResponse
----------------

[](#shipmentresponse)

```
$shipment->getShipmentTrackingNumber();

$shipment->getDispatchConfirmationNumber();

$shipment->getTrackingUrl();

$shipment->getLabelPdf();
```

---

Supported Features
==================

[](#supported-features)

FeatureStatusGet Rates✅Create Shipment✅Shipping Labels✅Customs Declaration✅DTO Requests✅Object Responses✅Tracking🚧Pickup🚧---

Requirements
============

[](#requirements)

- PHP 8.1+
- Guzzle 7+

---

Roadmap
-------

[](#roadmap)

- Get Rates
- Create Shipment
- Generate Labels
- Shipment Tracking
- Pickup Requests
- Laravel Service Provider
- Unit Tests

---

License
=======

[](#license)

MIT

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance90

Actively maintained with recent releases

Popularity3

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

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

Unknown

Total

1

Last Release

45d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/661b912ab1e25eab1395e9679292b9bae790d2a93b19e812cf252e82ebf31d9f?d=identicon)[HusseinAhmed2018](/maintainers/HusseinAhmed2018)

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/shipsa-dhl-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/shipsa-dhl-sdk/health.svg)](https://phpackages.com/packages/shipsa-dhl-sdk)
```

###  Alternatives

[laravel/framework

The Laravel Framework.

34.8k556.2M21.0k](/packages/laravel-framework)[laravel/horizon

Dashboard and code-driven configuration for Laravel queues.

4.2k99.8M341](/packages/laravel-horizon)[statamic/cms

The Statamic CMS Core Package

4.9k3.8M1.1k](/packages/statamic-cms)[leantime/leantime

Open source project management system for non-project managers. Simple like Trello, powerful like Jira. Built with neurodiversity in mind.

10.2k4.0k](/packages/leantime-leantime)[shetabit/multipay

PHP Payment Gateway Integration Package

298368.9k4](/packages/shetabit-multipay)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.8M647](/packages/shopware-core)

PHPackages © 2026

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