temmel/dhlpackageapi 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

temmel/dhlpackageapi

最新稳定版本:V0.1.3

Composer 安装命令:

composer require temmel/dhlpackageapi

包简介

DHL Package API client for PHP

README 文档

README

Contributors Forks Stargazers Issues project_license


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
  1. About The Project
  2. Getting Started
  3. License
  4. Acknowledgments

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.

(back to top)

Getting Started

It's a composer package.. what else to say?

Installation & Usage

  1. Get a API Key at https://developer.dhl.com

  2. Install per composer

    composer require mvdnbrk/dhlparcel-php-api
  3. 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);
  4. Manifest

    $manifests = $dhlparcel->shipments->manifest(['profile' => 'STANDARD_GRUPPENPROFIL', 'billingNumber' => 'YOUR-BILLING-NUMER', 'shipmentNumbers' => [$shipment->shipmentNo]]);
  5. 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);

(back to top)

License

Distributed under the project_license. See LICENSE.MD for more information.

(back to top)

Acknowledgments

(back to top)

统计信息

  • 总下载量: 3
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: proprietary
  • 更新时间: 2025-08-22