PHP code example of yangwenqu / ali_express

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

    

yangwenqu / ali_express example snippets




namespace App\Http\Controllers;

use Yangwenqu\NationalExpress\Express;

class DemoController
{
    protected $config = [
            'appcode'=> '你的阿里市场全国快递api服务appcode'
            ];
    
    public function index()
    {       
    
        $info  = ['no'=> '运单号','type'=> "快递公司type缩写"];

        $Express = new Express($this->config);
        //查快递信息
        $res     = $Express->getExpressInfo($info);
       var_dump($res);
       //获取快递公司信息
        $param = ['type'=> 'zto'];
        $res     = $Express->getExpressCompanyList($param); //参数不传则获取快递公司列表
       var_dump($res);
    }

    
}