Download the PHP package sonnenglas/dhl-parcel-de-sdk without Composer
On this page you can find all versions of the php package sonnenglas/dhl-parcel-de-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package dhl-parcel-de-sdk
DHL Parcel DE SDK
A PHP SDK for interacting with the DHL Parcel DE Shipping API (Post & Parcel Germany). This package allows you to easily create shipments, print labels, and manage shipments through the DHL API.
Installation
You can install the package via composer:
Requirements
- PHP 8.0 or higher
- Composer
- DHL API credentials (username, password, and API key)
Features
- Create shipments and generate labels
- Delete shipments
- Support for various DHL products (DHL Paket, DHL Paket International, etc.)
- Address validation
- Custom package dimensions and weight
- Support for production and sandbox environments
Usage
Initialization
Creating a Shipment
DHL Packstation Support
The SDK supports DHL Packstation deliveries, allowing customers to receive packages at automated parcel stations throughout Germany.
What is a Packstation?
DHL Packstations are automated parcel stations where customers can receive and send packages 24/7. They are located throughout Germany and provide a convenient alternative to home delivery.
Requirements for Packstation Delivery
To send a package to a DHL Packstation, you need:
- Packstation ID - A 3-digit number (100-999) identifying the specific packstation
- Customer's DHL Account Number (Postnummer) - A 6-10 digit number that customers receive when they register for DHL services
- Packstation Location - The postal code and city where the packstation is located
- Customer Name - The name of the person who will collect the package
Creating a Packstation Address
Complete Packstation Shipment Example
Packstation Validation Rules
The SDK validates packstation addresses according to DHL requirements:
- Packstation ID: Must be a 3-digit integer between 100 and 999
- Customer Number: Must be 6-10 digits (string)
- Country: Must be 'DE' (packstations are only available in Germany)
- Both Fields Required: If you provide one packstation field, you must provide both
- Company Field: Must be empty for packstation deliveries (private customers only)
API Format
The SDK automatically converts packstation addresses to the correct DHL API format:
Packstation Address (Locker format):
Regular Address (ContactAddress format):
Finding Packstations
Customers can find nearby packstations using:
- DHL website: https://www.dhl.de/de/privatkunden/pakete-empfangen/an-einem-abholort-empfangen/packstation-finden.html
- DHL mobile app
- DHL customer portal
Customer Registration
Customers need to register for DHL services to get their Postnummer (customer number):
- Online at: https://www.dhl.de/de/privatkunden/kundenservice/dhl-kundenkonto.html
- At DHL retail locations
- Through the DHL mobile app
The Postnummer is required for all packstation deliveries and is unique to each customer.
Deleting a Shipment
Using a Custom Profile
Setting Label Format
Complete Example
Here's a complete example showing how to use the SDK to create a shipment:
Available Products
The SDK supports the following DHL products:
ShipmentProduct::DhlPacket- DHL Paket (V01PAK)ShipmentProduct::DhlPacketInternational- DHL Paket International (V53WPAK)ShipmentProduct::DhlEuropaket- DHL Europaket (V54EPAK)ShipmentProduct::WarenPost- Warenpost (V62WP)ShipmentProduct::DhlKleinpaket- DHL Kleinpaket (V62KP)ShipmentProduct::WarenPostInternational- Warenpost International (V66WPI)
House Number Field (addressHouse)
Since v2.5.0 Address accepts an optional addressHouse argument that maps to DHL's dedicated house-number field on ContactAddress:
For the Parcel DE Returns API the separated form is mandatory — concatenating the number into addressStreet causes DHL to respond with 400 "Please add your data in the field 'Number'.". The Shipping API is more lenient and accepts both forms, but using addressHouse is recommended.
addressHouse is silently ignored for Packstation/Locker addresses.
Error Handling
The SDK provides several ways to handle errors:
- Exceptions are thrown for critical errors
- The
getLastErrorResponse()method provides detailed error messages from the DHL API - The
getLastRawResponse()method returns the complete API response for debugging
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Credits
Built and maintained by Przemek Peron.
License
The MIT License (MIT). Please see License File for more information.
All versions of dhl-parcel-de-sdk with dependencies
ext-json Version *
guzzlehttp/guzzle Version ^7.12.1
league/iso3166 Version ^4.3