temmel/dhlpackageapi
最新稳定版本:V0.1.3
Composer 安装命令:
composer require temmel/dhlpackageapi
包简介
DHL Package API client for PHP
README 文档
README
DHL Package API
This is a Composer package to handle the DHL Post & Parcel Germany, Parcel API and the DHL Shipment Tracking - Unified API
Explore the docs »
Report Bug
·
Request Feature
Table of Contents
About The Project
This is a Composer Package to handle most of the tasks on the DHL API to send packages and track its whereabouts. Initially only created for our own needs, but why not release it. I could not find anything like this. so here you have it... use it like you want.
I used mvdnbrk/dhlparcel-php-api as my basis and changed some stuff and build my own version.
This Package uses and older version of "collection" to ensure backwards-compatibility. Maybe some time in the future I will upgrade it. We will see.
Getting Started
It's a composer package.. what else to say?
Installation & Usage
-
Get a API Key at https://developer.dhl.com
-
Install per composer
composer require mvdnbrk/dhlparcel-php-api
-
Enter your API, create a package and send it to DHL
require __DIR__ . '/vendor/autoload.php'; use Temmel\DHLPackageAPI\Client; $dhlparcel = new Client($debug = false); $dhlparcel->setUserName('USER-NAME'); $dhlparcel->setUserPassword('USER-PASSWORD'); $dhlparcel->setClientID('CLIENT-ID'); $dhlparcel->setClientSecret('CLIENT-SECRET'); $package_data = [ 'profile' => 'STANDARD_GRUPPENPROFIL', 'product' => '', 'refNo' => '', 'billingNumber' => 'YOUR-BILLING-NUMGER', 'sender' => [ 'shipperRef' => 'YOUR-OWN-SHIPPERREF-IF-EXISTS', ], 'recipient' => [ 'name1' => 'NAME', 'contactName' => 'CONTACTNAME', 'addressStreet' => 'STREET (AND NUMBER)', 'addressHouse' => 'NUMBER IF NOT IN STREET', 'number_suffix' => '', 'postalCode' => 'POSTALCODE', 'city' => 'CITY', 'country' => 'COUNTRY (3 LETTERS)', 'email' => 'E-MAIL', ], 'sender' => [ 'name1' => 'NAME', 'addressStreet' => 'STREET (AND NUMBER)', 'addressHouse' => 'NUMBER IF NOT IN STREET', 'additional_address_line' => '', 'postalCode' => 'POSTALCODE', 'city' => 'CITY', 'country' => 'COUNTRY (3 LETTERS)', 'email' => 'E-MAIL' ] ]; $package = new Package($package_data); // THIS OPTIONS ARE ALREADY THE STANDARD, CHANGE IF NEEDED $package->options->details = [ 'dim' => [ 'uom' => 'mm', 'height' => '100', 'width' => '150', 'length' => '200', ], 'weight' => [ 'uom' => 'g', 'value' => 500, ], ]; $shipment = $dhlparcel->shipments->create($package); // LOOK UP WHAT YOU NEED ;) dump($shipment);
-
Manifest
$manifests = $dhlparcel->shipments->manifest(['profile' => 'STANDARD_GRUPPENPROFIL', 'billingNumber' => 'YOUR-BILLING-NUMER', 'shipmentNumbers' => [$shipment->shipmentNo]]);
-
Tracking (This will not work directly after creating the shipping, you must manifest the shipping (or wait till the next day) and then wait another half an hour.)
$tracking = $dhlparcel->tracking->get($shipment->shipmentNo);
License
Distributed under the project_license. See LICENSE.MD for more information.
Acknowledgments
统计信息
- 总下载量: 3
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: proprietary
- 更新时间: 2025-08-22