Download the PHP package medzuch/dhl-express-php without Composer
On this page you can find all versions of the php package medzuch/dhl-express-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download medzuch/dhl-express-php
More information about medzuch/dhl-express-php
Files in medzuch/dhl-express-php
Package dhl-express-php
Short Description DHL Express API connector library
License MIT
Homepage https://github.com/medzuch/dhl-express-php
Informations about the package dhl-express-php
medzuch/dhl-express-php
A clean, framework-agnostic PHP 8.3 library for the DHL Express MyDHL API 3.2.2.
Features
| Domain | Operations |
|---|---|
| Tracking | Single shipment tracking, multi-shipment tracking |
| Shipments | Create shipment, upload PLT image, upload invoice data, add piece, get image |
| Rates | Single-piece rates (GET), multi-piece rates (POST) |
| Landed Cost | Estimate duties and taxes |
| Pickups | Create, update, cancel pickup bookings |
| Products | List available shipping products |
| Address | Validate destination addresses |
| Service Points | Find DHL service points |
| EPOD | Electronic proof of delivery |
| Identifiers | Resolve tracking identifiers |
| Reference Data | Look up DHL code lists |
| Early Shipment Screening | BBX Denied Party screening (POST /early-shipment-screening) |
Requirements
- PHP 8.3+
ext-json
Installation
The library uses php-http/discovery to auto-detect a PSR-18 HTTP client and PSR-17 factories at runtime. Any PSR-18 compliant client works — Guzzle 7 is the recommended default.
If you want to use a different client (e.g. Symfony HttpClient), require it instead and it will be discovered automatically. You can also inject any PSR-18/PSR-17 implementation directly via the DhlClient constructor.
Quick Start
Usage Examples
Track a Shipment
Use
tracking()->getMany(...)to track up to 200 shipments in a single call. It returns alist<TrackingResponse>with the same flat shape per entry.
Get Shipping Rates
Create a Shipment
Cross-border Shipment with Customs Declaration
Book a Pickup
Error Handling
All exceptions extend DhlException. Catch the specific type you care about:
Configuration
Custom HTTP Client
Any PSR-18 compliant client can be injected:
Logging
Pass any PSR-3 logger to capture request and response payloads at debug level. The Authorization header is automatically redacted:
Timeout
Timeout configuration is handled by your PSR-18 HTTP client, not by ClientConfig. When using the default Guzzle client, pass a configured instance via the DhlClient constructor:
Development
Setup
Make Targets
| Command | Description |
|---|---|
make test |
Run PHPUnit unit suite |
make test-integration |
Run integration tests (requires env vars below) |
make analyse |
PHPStan on src/ (level max) |
make analyse-all |
PHPStan on src/ and tests/ |
make cs-fix |
Fix code style |
make cs-check |
Check style without modifying |
make check |
Tests + full analysis + style check |
make shell |
Shell inside container |
Integration Tests
Integration tests hit the real DHL Express sandbox. To run them locally:
In GitHub Actions, the nightly Integration Tests workflow needs the same three values configured under repo settings — but split between Secrets and Variables:
- Secrets (Settings → Secrets and variables → Actions → Secrets):
DHL_API_KEY,DHL_API_SECRET - Variables (Settings → Secrets and variables → Actions → Variables):
DHL_ACCOUNT_NUMBER
The account number is stored as a variable rather than a secret because workflow if: conditions can read variables but not secrets — that lets the workflow skip cleanly on forks where credentials aren't configured.
License
MIT — see LICENSE.
All versions of dhl-express-php with dependencies
psr/http-client Version ^1.0
psr/http-factory Version ^1.1
psr/log Version ^3.0
php-http/discovery Version ^1.20