yiier / yii2-cross-border-express
跨境快递接口
Installs: 574
Dependents: 0
Suggesters: 0
Security: 0
Stars: 29
Watchers: 7
Forks: 8
Open Issues: 1
Type:yii2-extension
Requires
- php: >=7.1
- ext-json: *
- ext-libxml: *
- ext-simplexml: *
- ext-xml: *
- econea/nusoap: ^0.9.6
- guzzlehttp/guzzle: ^6.3
- yiier/yii2-aliyun-oss: *
- yiisoft/yii2: ^2.0
- dev-master
- v1.12.21
- v1.12.20
- v1.12.19
- v1.12.18
- v1.12.17
- v1.12.16
- v1.12.15
- v1.12.14
- v1.12.13
- v1.12.12
- v1.12.11
- v1.12.10
- v1.12.9-alpha
- v1.12.8
- v1.12.7
- v1.12.6
- v1.12.5
- v1.12.4
- v1.12.3
- v1.12.2
- v1.12.1
- v1.12.0
- v1.11.3
- v1.11.2
- v1.11.1
- v1.10.10
- v1.10.9
- v1.10.8
- v1.10.7
- v1.10.6
- v1.10.5
- v1.10.4
- v1.10.3
- v1.10.2
- v1.10.1
- v1.10.0
- v1.9.3
- v1.9.2
- v1.9.1
- v1.9.0
- v1.8.4
- v1.8.3
- v1.8.2
- v1.8.1
- v1.8.0
- v1.7.0
- v1.5.1
- v1.5.0
- v1.4.2
- v1.4.1
- v1.4.0
- v1.3.3
- v1.3.2
- v1.3.1
- v1.3.0
- v1.2.10
- v1.2.9
- v1.2.8
- v1.2.7
- v1.2.6
- v1.2.5
- v1.2.4
- v1.2.3
- v1.2.2
- v1.2.1
- v1.2.0
- v1.1.3
- v1.1.2
- v1.1.1
- v1.1.0
- v1.0.2
- v1.0.1
- v1.0.0
- v0.4.7
- v0.4.6
- v0.4.5
- v0.4.4
- v0.4.3
- v0.4.2
- v0.4.1
- v0.4
- v0.3
- v0.2
- v0.1
This package is auto-updated.
Last update: 2024-10-29 05:11:05 UTC
README
跨境物流接口,目前只支持:
- 云途物流
- 三态速递
- 飞特物流
- 华磊物流
- 集优物流
- 万邦物流
- 速递管家
- 易仓物流
- 顺丰国际物流
- K5物流系统
- 燕文物流
- 互联通物流
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist yiier/yii2-cross-border-express "*"
or add
"yiier/yii2-cross-border-express": "*"
to the require section of your composer.json
file.
Usage
配置
<?php $config = [ // HTTP 请求的超时时间(秒) 'timeout' => 5.0, // 可用的平台配置 'platforms' => [ 'santai' => [ 'appKey' => 'xxx', 'token' => 'xxx', 'userId' => 'xxx' ], 'yuntu' => [ 'account' => 'xxx', 'secret' => 'xxx', ], 'feite' => [ 'token' => 'xxx', 'syncPlatformId' => '', // 订单同步平台标识(一般指第三方平台标识,格式类似:scb.logistics.flyt) 'accountId' => 'xxx', 'password' => '', 'printUsername' => '', // 面单接口需要 'printPassword' => '' // 面单接口需要 ], 'hualei' => [ 'host' => '', 'print_host' => '', 'customer_id' => '', # 如果customer_id和customer_user_id不为空可不填username及password 'customer_user_id' => '', 'username' => '', 'password' => '', ], 'jiyou' => [ 'host' => '', 'user_token' => '' ], 'wanb' => [ "host" => "http://api-sbx.wanbexpress.com", "account_no" => "", "token" => "", "warehouse_code" => "", "oss_wan_domain" => "oss-cn-beijing.aliyuncs.com", "oss_lan_domain" => "oss-cn-beijing-internal.aliyuncs.com", "oss_bucket" => "", "oss_access_key_id" => "", "oss_access_key_secret" => "", ], 'courierbutler' => [ "host" => "http://lfn.rtb56.com", "app_token" => "", "app_key" => "", ], 'eccang' => [ "appKey" => "", "appToken" => "", "host" => "" ], 'sfexpress' => [ "accesscode" => "", "username" => "", "checkword" => "", "platform_code" => "", ], 'k5' => [ "host" => "", "clientid" => "", "token" => "", ], 'yw56' => [ "host" => '', "userId" => '', "token" => '', "ossBucket" => '', "ossAccessKeyId" => '', "ossAccessKeySecret" => '', "ossLanDomain" => "oss-accelerate-internal.aliyuncs.com", "ossWanDomain" => "oss-accelerate.aliyuncs.com", ], 'huiliantong' => [ 'host' => "", 'userToken' => '' ] ], ]; $express = new \yiier\crossBorderExpress\Express($config, 'santai');
发货
<?php $expressOrder = new \yiier\crossBorderExpress\contracts\Order(); $expressOrder->customerOrderNo = 'xxx'; $expressOrder->transportCode = 'xxx'; $goods[] = new \yiier\crossBorderExpress\contracts\Goods(); $goods->description = 'xxx'; $goods->cnDescription = 'xxx'; $goods->quantity = 'xxx'; $goods->weight = 'xxx'; $goods->hsCode = 'xxx'; $goods->enMaterial = 'cotton'; $goods->cnMaterial = '棉'; $goods->worth = 1; // 1美元; $goods->sku = 'xxx'; // 云途某些渠道需要 $expressOrder->goods = $goods; $expressOrder->evaluate = 1; // 1美元 $expressOrder->taxesNumber = 'xxx'; // 税号 $expressOrder->isRemoteConfirm = 1; // 是否同意收偏远费 $expressOrder->isReturn = 1; // 是否退件 $expressOrder->withBattery = 0; // 是否带电池 $package = new \yiier\crossBorderExpress\contracts\Package(); $package->description = 'xxxx'; $package->quantity = 1; $package->weight = 'xxx'; $package->declareWorth = 1; // 1美元 $expressOrder->package = $package; $recipient = new \yiier\crossBorderExpress\contracts\Recipient(); $recipient->countryCode = 'xx'; $recipient->name = 'xx'; $recipient->address = 'xx'; $recipient->city = 'xx'; $recipient->state = 'xx'; $recipient->zip = 'xx'; $recipient->phone = 'xx'; $expressOrder->recipient = $recipient; $shipper = new \yiier\crossBorderExpress\contracts\Shipper(); $shipper->countryCode = 'CN'; $shipper->name = 'xxx'; $shipper->company = 'xxx'; $shipper->address = 'xxx'; $shipper->city = 'xxx'; $shipper->state = 'xxx'; $shipper->zip = 'xx'; $shipper->phone = 'xxx'; $expressOrder->shipper = $shipper; // 发货 $express->createOrder($expressOrder);
获取物流方式
<?php $countryCode = 'US'; $item = []; if (!empty($transports = $express->getTransportsByCountryCode($countryCode))) { foreach ($transports as $transport) { // 带跟踪号的物流方式 $item[$transport->code] = [ 'code' => $transport->code, 'name' => $transport->cnName, 'is_tracking_no' => (int)$transport->ifTracking, 'data' => $transport->data, ]; } } return $item;
获取打印地址
<?php $orderNumber = 'xxx'; $express->getPrintUrl($orderNumber);
获取订单详细费用
<?php $orderNumber = 'xxx'; $express->getOrderFee($orderNumber);