gunjanpatel/dhl-parcel-api 问题修复 & 功能扩展

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

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

gunjanpatel/dhl-parcel-api

Composer 安装命令:

composer require gunjanpatel/dhl-parcel-api

包简介

The DHL Parcel Business customer shipping API. DHL developer account required.

README 文档

README

Latest Stable Version Total Downloads Latest Unstable Version License

Setup

You can use composer to use this library.

{
    "require": {
        "gunjanpatel/dhl-parcel-api": "*"
    }
}

or you may install using composer command.

composer require gunjanpatel/dhl-parcel-api:*

Configuration

Set configuration variables at etc/config.json.

cp etc/config.dist.json etc/config.json

Examples of sending request to DHL

Request a shipment - html/shipment.php

require_once __DIR__ . '/vendor/autoload.php';

use DHL\Client\Soap as DhlSoapClient;
use DHL\Data\Shipper;
use DHL\Data\Receiver;
use DHL\Data\Shipment as ShipmentDetail;
use DHL\Request\Business\CreateShipment;

// Our company info
$shipper = new Shipper(
	[
		'company_name'   => 'Garnio Aps',
		'street_name'    => 'Clayallee',
		'street_number'  => '241',
		'zip'            => '14165',
		'city'           => 'Berlin',
		'email'          => 'company@hello.dk',
		'phone'          => '01788338795',
		'contact_person' => 'Gunjan Patel',
		'comment'        => '',
	]
);

$customer_details = [
	'name'           => 'Gunjan Patel',
	'street_name'    => 'Clayallee',
	'street_number'  => '12',
	'zip'            => 14165,
	'city'           => 'Berlin',
	'email'          => 'user@hello.dk',
	'phone'          => '1234567890',
	'contact_person' => 'Gunjan Patel',
	'comment'        => 'Just test',
];

$receiver = new Receiver($customer_details);

$detail = new ShipmentDetail(
	[
		'product'       => 'V01PAK',
		'accountNumber' => '2222222222220101',
		// 'customerReference'           => '',     // Optional
		'shipmentDate'  => date('Y-m-d'),
		// 'returnShipmentAccountNumber' => $config['ekp'],       // Optional
		// 'returnShipmentReference'     => '',     // Optional
	]
);

// Needs to convert weight into KG
$detail->item(['weight' => 10])
	->notify('user@hello.dk');

$shipment = new CreateShipment;
$shipment->setOrderId(123456)
	->detail($detail)
	->shipper($shipper)
	->receiver($receiver)
	->labelType('B64');

$client = new DhlSoapClient(true);

$response = $client->call($shipment);

echo "<pre>";
print_r($response);
echo "</pre>";

Get Label - PDF - html/label.php

require_once __DIR__ . '/vendor/autoload.php';

use DHL\Client\Soap as DhlSoapClient;
use DHL\Request\Business\Label;

$client = new DhlSoapClient(true);

$label = new Label('1234567890987654321');
$response = $client->call($label);

echo "<pre>";
print_r($response);
echo "</pre>";

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-12-22

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固