PHP code example of flex / express

1. Go to this page and download the library: Download flex/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/ */

    

flex / express example snippets


use Flex\Express\Express100;

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

use Flex\Express\ExpressBird;

$express = new ExpressBird('app_id','app_key'); 
$info = $express->track($tracking_code, $shipping_code,$order_code); //快递单号 物流公司编号 订单编号(选填)

use Flex\Express\Express;


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

//快递鸟$additional=['order_code'=>111111] 快递100 $additional=['phone'=>'18899996666']
$info = $express->track($tracking_code, $shipping_code,$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
}