Search by

nogrod / dhl-shipping-php-sdk

Nogrod

Note: This is the specification of the DPDHL Group Parcel DE Shipping API for Post & Parcel Germany. This REST web service allows business customers to create shipping labels on demand.

Package info

github.com/Nogrod/dhl-shipping-php-sdk

Homepage

pkg:composer/nogrod/dhl-shipping-php-sdk

Statistics

Installs: 824

Dependents: 0

Suggesters: 0

Stars: 1

Open Issues: 0

v0.3.1 2026-10-29 12:38 UTC

This package is auto-updated.

Last update: 2026-10-29 12:39:02 UTC


README

Note: This is the specification of the DPDHL Group Parcel DE Shipping API for Post & Parcel Germany. This REST web service allows business customers to create shipping labels on demand.

Installation & Usage

Requirements

PHP 8.1 and later.

Composer

To install the bindings via Composer, add the following to composer.json:

{
  "repositories": [
    {
      "type": "vcs",
      "url": "https://github.com/nogrod/dhl-shipping-php-sdk.git"
    }
  ],
  "require": {
    "nogrod/dhl-shipping-php-sdk": "*@dev"
  }
}

Then run composer install

Manual Installation

Download the files and include autoload.php:

<?php
require_once('/path/to/OpenAPIClient-php/vendor/autoload.php');

Getting Started

Please follow the installation procedure and then run the following:

<?php
require_once(__DIR__ . '/vendor/autoload.php');



// Configure OAuth2 access token for authorization: OAuth2
$config = Dhl\Rest\Shipping\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

// Configure API key authorization: ApiKey
$config = Dhl\Rest\Shipping\Configuration::getDefaultConfiguration()->setApiKey('dhl-api-key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Dhl\Rest\Shipping\Configuration::getDefaultConfiguration()->setApiKeyPrefix('dhl-api-key', 'Bearer');

// Configure HTTP basic authorization: BasicAuth
$config = Dhl\Rest\Shipping\Configuration::getDefaultConfiguration()
              ->setUsername('YOUR_USERNAME')
              ->setPassword('YOUR_PASSWORD');


$apiInstance = new Dhl\Rest\Shipping\Api\CustomsDocumentsApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$documents = array(new \Dhl\Rest\Shipping\Model\\Dhl\Rest\Shipping\Model\CustomsDocumentUploadItem()); // \Dhl\Rest\Shipping\Model\CustomsDocumentUploadItem[] | List of customs documents to upload. Submitted as multipart form fields using bracket notation, e.g. documents[0].documentType, documents[0].userDefinedReference, documents[0].data, documents[1]...
$accept_language = de-DE; // string | Control the APIs response language via locale abbreviation. English (en-US) and german (de-DE) are supported. If not specified, the default is english.

try {
    $result = $apiInstance->customsDocumentsPost($documents, $accept_language);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling CustomsDocumentsApi->customsDocumentsPost: ', $e->getMessage(), PHP_EOL;
}

API Endpoints

All URIs are relative to https://api-eu.dhl.com/parcel/de/shipping/v2

Class Method HTTP request Description
CustomsDocumentsApi customsDocumentsPost POST /customs-documents Upload customs documents for paperless customs clearance
GeneralApi rootGet GET / Return API version
ManifestsApi getManifests GET /manifests Retrieve daily manifest document
ManifestsApi manifestsPost POST /manifests Mark shipments as being ready for shipping
ShipmentsAndLabelsApi createOrders POST /orders Create one or more shipments and their documents. (This is the primary call of the API.)
ShipmentsAndLabelsApi getLabel GET /labels Download PDF document
ShipmentsAndLabelsApi getOrder GET /orders Retrieve shipment documents - labels and customs documents
ShipmentsAndLabelsApi ordersAccountDelete DELETE /orders Delete one or more shipments

Models

Authorization

BasicAuth

  • Type: HTTP basic authentication

ApiKey

  • Type: API key
  • API key parameter name: dhl-api-key
  • Location: HTTP header

OAuth2

  • Type: OAuth
  • Flow: password
  • Authorization URL: ``
  • Scopes: N/A

Tests

To run the tests, use:

composer install
vendor/bin/phpunit

Author

About this package

This PHP package is automatically generated by the OpenAPI Generator project:

  • API version: 2.2.0
    • Generator version: 7.26.0
  • Build package: org.openapitools.codegen.languages.PhpNextgenClientCodegen