PHP code example of finecho / logistics

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

    

finecho / logistics example snippets

	

use Finecho\Logistics\Logistics;

$config = [
    'provider' => 'aliyun', // aliyun/juhe/kd100
    
    'aliyun' => [
        'app_code' => 'xxxxxxxx',
    ],
    
    'juhe' => [
         'app_code' => 'xxxxx',
    ],
    
    'kdniao' => [
             'app_code' => 'xxxxx',
             'customer' => 'xxxxx',
    ],
        
    'kd100' => [
         'app_code' => 'xxxxx',
         'customer' => 'xxxxx',
    ],
];

$logistics = new Logistics($config);
	
$companies = $logistics->companies();	
	
$order = $logistics->query('805741929402797742', '圆通');

php artisan vendor:publish --provider="Finecho\Logistics\ServiceProvider"
	
    .	
    .	
    .	
    public function show(Logistics $logistics, $no, $company) 	
    {	
        $order = $logistics->query($no, $company);
        
        return $order;	// $order->getList(); .....
    }	
    .	
    .	
    .	
	
    .	
    .	
    .	
    public function show($no, $company) 	
    {	
        $response = app('logistics')->query($no, $company);	
    }	
    .	
    .	
    .
 

$order['company']; // '圆通' (因为各个平台对公司的名称有所不一致,所以查询结果或许会有些许差别)
$order['list']; // ....
$order['original']; // 获取接口原始返回信息
...