PHP code example of yihaitao / express

1. Go to this page and download the library: Download yihaitao/express library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

yihaitao / express example snippets


use YiHaiTao\Express\Express100;

$express = new Express100('app_id','app_key');
$info = $express->track($trackingCode, $shippingCode, $phone); //快递单号 物流公司编号 收件人手机号(顺丰必填 其他快递选填)

use YiHaiTao\Express\ExpressBird;

$express = new ExpressBird('app_id','app_key'); 
$info = $express->track($trackingCode, $shippingCode, $phone, $orderCode, $requestType = '8002'); //快递单号 物流公司编号 手机号 订单编号(选填) 请求类型

use YiHaiTao\Express\Express;

$express = new Express($app_id,$app_key,$type); //$type支持类型'express100'、'expressbird'

// 快递鸟  $additional=['order_code'=>111111, 'request_type'=>'8002', 'phone'=>'13012345678'] 
// 快递100 $additional=['phone'=>'18899996666']
$info = $express->track($trackingCode, $shippingCode,$additional); ////查询物流 快递单号 额外参数

'express' => [
    'id' => env('EXPRESS_ID'),
    'key' => env('EXPRESS_KEY'),
    'type' => env('EXPRESS_TYPE'),
],

public function edit(Express $express) 
{
    $response = $express->track('888888888', 'YTO');
}

public function edit() 
{
    $response = app('express')->track('888888888', 'YTO');
}
json
{
    "LogisticCode": "8888888888888888",
    "ShipperCode": "YTO",
    "Traces": [
        {
            "AcceptStation": "【四川省直营市场部公司】 取件人: 四川省直营市场部41 已收件",
            "AcceptTime": "2019-03-21 11:03:40"
        },
        {
            "AcceptStation": "【四川省直营市场部公司】 已收件",
            "AcceptTime": "2019-03-21 13:45:01"
        },
        {
            "AcceptStation": "【成都转运中心】 已收入",
            "AcceptTime": "2019-03-21 22:40:01"
        }
    ],
    "State": "3",
    "OrderCode": "",
    "EBusinessID": "100000",
    "Success": true
}