PHP code example of lvar / easy-51tracking

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

    

lvar / easy-51tracking example snippets




use Ivar\Easy51Tracking\Easy51Tracking;

$config = [
    'tracking_api_key' => '自己申请',
];

$obj = new Easy51Tracking($config);
$result = $obj->getAllCarriers();




use Ivar\Easy51Tracking\Easy51Tracking;

$config = [
    'tracking_api_key' => '自己申请',
];
$params = [
    'tracking_number' => '物流运单号',// 必填
    'carrier_code'    => '运输商编码',// 必填
    //... 若干别的信息,可查api文档
];

$obj = new Easy51Tracking($config);
$result = $obj->create($params);




use Ivar\Easy51Tracking\Easy51Tracking;

$config = [
    'tracking_api_key' => '自己申请',
];
$tracking_number = '物流运单号';
$carrier_code    = '运输商编码';

$params = [
    'title' => '这是测试',
    //... 若干别的信息,可查api文档
];

$obj = new Easy51Tracking($config);
$result = $obj->updateOneOrderTrackingByNumber($carrier_code,$tracking_number,$params);




use Ivar\Easy51Tracking\Easy51Tracking;

$config = [
    'tracking_api_key' => '自己申请',
];

$tracking_number = '物流运单号';
$carrier_code    = '运输商编码';

$obj = new Easy51Tracking($config);
$result = $obj->getOrderTrackingByNumber($carrier_code,$tracking_number);




use Ivar\Easy51Tracking\Easy51Tracking;

$config = [
    'tracking_api_key' => '自己申请',
];
$tracking_number = '物流运单号';
$carrier_code    = '运输商编码';

$obj = new Easy51Tracking($config);
$result = $obj->deleteOneOrderTrackingByNumber($carrier_code,$tracking_number);