PHPackages                             chrissantiago82/dhlparcel-php-api - 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. chrissantiago82/dhlparcel-php-api

ActiveLibrary[API Development](/categories/api)

chrissantiago82/dhlparcel-php-api
=================================

DHL Parcel API client for PHP

1.0.0(1y ago)03MITPHPPHP ^7.2 || ^8.0

Since Sep 13Pushed 1y agoCompare

[ Source](https://github.com/ChrisSantiago82/dhlparcel-php-api)[ Packagist](https://packagist.org/packages/chrissantiago82/dhlparcel-php-api)[ Docs](https://github.com/mvdnbrk/dhlparcel-php-api)[ GitHub Sponsors](https://github.com/mvdnbrk)[ RSS](/packages/chrissantiago82-dhlparcel-php-api/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (8)Versions (2)Used By (0)

DHL Parcel API client for PHP
=============================

[](#dhl-parcel-api-client-for-php)

[![PHP version](https://camo.githubusercontent.com/9fe8cc481f0030446f35fba0a77e8dd819737d9d934b69b7664105909fbd5dd3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6d76646e62726b2f64686c70617263656c2d7068702d6170693f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/9fe8cc481f0030446f35fba0a77e8dd819737d9d934b69b7664105909fbd5dd3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6d76646e62726b2f64686c70617263656c2d7068702d6170693f7374796c653d666c61742d737175617265)[![Latest Version on Packagist](https://camo.githubusercontent.com/7d593b0ecaf53399b26023e9936038b981d01a0778d6d81aee7fe33c3df95d70/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d76646e62726b2f64686c70617263656c2d7068702d6170692e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mvdnbrk/dhlparcel-php-api)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Tests](https://camo.githubusercontent.com/1f55b46200a90b4d07d73e4eb0de26a0c3af394601a19da8310e54d317b6d0f9/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f6d76646e62726b2f64686c70617263656c2d7068702d6170692f74657374732f6d61696e3f6c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/mvdnbrk/dhlparcel-php-api/actions?query=workflow%3Atests)[![Code style](https://camo.githubusercontent.com/36af3d160fc67f3aa374b473aa25270973ee3630c0b5e9c9cd5191f26981f5f2/68747470733a2f2f7374796c6563692e696f2f7265706f732f3137313030363432372f736869656c643f6272616e63683d6d61696e)](https://styleci.io/repos/171006427)[![Total Downloads](https://camo.githubusercontent.com/b6ebbf2b81a698be884395d4308d815b6a4f64dfee0bfc85efa755a69bdc5eb1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d76646e62726b2f64686c70617263656c2d7068702d6170692e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mvdnbrk/dhlparcel-php-api)

[DHL Parcel API documentation](https://api-gw.dhlparcel.nl/docs/)

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

[](#installation)

You can install the package via composer:

```
composer require mvdnbrk/dhlparcel-php-api
```

Usage
-----

[](#usage)

Initialize the DHL Parcel client and set your credentials.

```
$dhlparcel = new \Mvdnbrk\DhlParcel\Client();

$dhlparcel->setUserId('your-user-id');
$dhlparcel->setApiKey('your-api-key');
```

If you have multipe accounts, you may optionally set an account id:

```
$dhlparcel->setAccountId('123456');

```

### Create a parcel

[](#create-a-parcel)

```
$parcel = new \Mvdnbrk\DhlParcel\Resources\Parcel([
    'reference' => 'your own reference for the parcel (optional)',
    'recipient' => [
        'first_name' => 'John',
        'last_name' => 'Doe',
        'street' => 'Poststraat',
        'number' => '1',
        'number_suffix' => 'A',
        'postal_code' => '1234AA',
        'city' => 'Amsterdam',
        'cc' => 'NL',
    ],
    'sender' => [
        'company_name' => 'Your Company Name',
        'street' => 'Pakketstraat',
        'additional_address_line' => 'Industrie 9999',
        'number' => '99',
        'postal_code' => '9999AA',
        'city' => 'Amsterdam',
        'cc' => 'NL',
    ],
    // Optional. This will be set as the default.
    'pieces' => [
        [
            'parcel_type' => \Mvdnbrk\DhlParcel\Resources\Piece::PARCEL_TYPE_SMALL,
            'quantity' => 1,
        ],
    ],
]);
```

### Create the shipment

[](#create-the-shipment)

```
$shipment = $dhlparcel->shipments->create($parcel);

$shipment->id;
// For shipments with multiple pieces:
$shipment->pieces->each(function ($item) {
    $item->label_id;
    $item->barcode;
})
// For a shipment with one single piece:
$shipment->label_id;
$shipment->barcode;
```

### Retrieving a label

[](#retrieving-a-label)

A label can be retrieved by using the `label_id`. This will return a PDF label as a string.

```
$dhlparcel->labels->get($shipment->label_id);

```

Or you may pass the `Shipment` instance directly to this method:

```
$dhlparcel->labels->get($shipment);

```

> Passing a `Shipment` instance will only retrieve the label for a shipment with a single piece, or the first piece if you have created a shipment with multple pieces. If you have created a shipment with multiple pieces you should retrieve the labels one by one for each piece your shipment contains.

### Setting delivery options for a parcel

[](#setting-delivery-options-for-a-parcel)

You can set delivery options for a parcel by passing in the options directly when you create a parcel:

```
$parcel = new \Mvdnbrk\MyParcel\Resources\Parcel([
    ...
    'recipient' => [
        ...
    ],
    'options' => [
        'description' => 'Order #123',
        'signature' => true,
        'only_recipient' => true,
        'cash_on_delivery' => 9.95,
        'evening_delivery' => true,
        'extra_assurance' => true,
        ...
    ],
]);
```

Or you may use a method like `signature()` and others after constructing the parcel:

```
$parcel->onlyRecipient()
       ->signature()
       ->labelDescription('Order #123')
       ->cashOnDelivery(9.95)
       ->eveningDelivery()
       ->extraAssurance();
```

**Mailbox package**

If you would like to send a parcel that fits in a standard mailbox you may use the `mailboxpackage()` method:

```
$parcel->mailboxpackage();
```

**Deliver a parcel to a DHL service point**

You may send a parcel to a DHL service point where a customer can pick up the parcel. The ID of the service point can be set directly when creating a parcel or with the `servicePoint` method:

```
$parcel = new \Mvdnbrk\MyParcel\Resources\Parcel([
    ...
    'options' => [
        'service_point_id' => '8004-NL-272403',
        ...
    ],
]);

$parcel->servicePoint('8004-NL-272403');
```

### Tracking a shipment

[](#tracking-a-shipment)

```
$tracktrace = $dhlparcel->tracktrace->get('JVGL...');

// Check if the shipment is delivered:
$tracktrace->isDelivered;
```

### Retrieving service points

[](#retrieving-service-points)

```
$servicepoints = $dhlparcel->servicePoints->setPostalcode('1012AA')->setHousenumber('1')->get();
```

This will return a collection of `ServicePoint` objects:

```
$servicepoints->each(function ($item) {
    $item->id;
    $item->name;
    $item->latitude;
    $item->longitude;
    $item->distance;
    $item->distanceForHumans();
});

```

Usage with Laravel
------------------

[](#usage-with-laravel)

You may incorporate this package in your Laravel application by using [this package](https://github.com/mvdnbrk/laravel-dhlparcel).

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Mark van den Broek](https://github.com/mvdnbrk)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance35

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 96.9% 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

Unknown

Total

1

Last Release

611d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/91efba45c85333cb4f4486de2118bc39e30dfe724f441497c8847804f401a33d?d=identicon)[Christoph@krebs-programming.com](/maintainers/Christoph@krebs-programming.com)

---

Top Contributors

[![mvdnbrk](https://avatars.githubusercontent.com/u/802681?v=4)](https://github.com/mvdnbrk "mvdnbrk (312 commits)")[![jacobdekeizer](https://avatars.githubusercontent.com/u/15017400?v=4)](https://github.com/jacobdekeizer "jacobdekeizer (4 commits)")[![Thorry84](https://avatars.githubusercontent.com/u/6595047?v=4)](https://github.com/Thorry84 "Thorry84 (2 commits)")[![ChrisSantiago82](https://avatars.githubusercontent.com/u/43000085?v=4)](https://github.com/ChrisSantiago82 "ChrisSantiago82 (1 commits)")[![bastiaansenglenn](https://avatars.githubusercontent.com/u/33938529?v=4)](https://github.com/bastiaansenglenn "bastiaansenglenn (1 commits)")[![rickyheijnen](https://avatars.githubusercontent.com/u/1956522?v=4)](https://github.com/rickyheijnen "rickyheijnen (1 commits)")[![tom-it](https://avatars.githubusercontent.com/u/1961824?v=4)](https://github.com/tom-it "tom-it (1 commits)")

---

Tags

apiparceldhl

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/chrissantiago82-dhlparcel-php-api/health.svg)

```
[![Health](https://phpackages.com/badges/chrissantiago82-dhlparcel-php-api/health.svg)](https://phpackages.com/packages/chrissantiago82-dhlparcel-php-api)
```

###  Alternatives

[mvdnbrk/dhlparcel-php-api

DHL Parcel API client for PHP

3957.9k5](/packages/mvdnbrk-dhlparcel-php-api)[openai-php/laravel

OpenAI PHP for Laravel is a supercharged PHP API client that allows you to interact with the Open AI API

3.7k7.6M74](/packages/openai-php-laravel)[jouwweb/sendcloud

Provides a client to interact with the Sendcloud API in an object-oriented way.

16256.9k1](/packages/jouwweb-sendcloud)[mvdnbrk/laravel-dhlparcel

DHL Parcel API client for Laravel

1717.3k](/packages/mvdnbrk-laravel-dhlparcel)[walle89/swedbank-json

Unofficial API client for the Swedbank's and Sparbanken's mobile apps in Sweden.

752.5k](/packages/walle89-swedbank-json)

PHPackages © 2026

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