PHP code example of xionglonghua / yii2-jtexpress-api

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

    

xionglonghua / yii2-jtexpress-api example snippets


return [
    'components' => [
        'express' => [
            'class'    => 'xionglonghua\express\JtExpress',
        ],
    ],
    // ....
];

[
    'express' => [
        'jnt' => [
            'key'          => '',
            'username'     => '',
            'API_KEY'      => '',
            'orderHost'    => '',
            'trackingHost' => '',
            'cancelHost'   => '',
        ],
    ],
];


    Yii::$app->express->getOrderInfo('123765');


    $params = [
        'orderid'=>'ORDERID-0001', //必填,电商的订单号
        'shipper_name'=>'PENGIRIM',  //必填,寄件人名字
        'shipper_contact'=>'PENGIRIM',  //必填,联系人名字(跟寄件人名字一样)
        'shipper_phone'=> '+628123456789',  //必填,寄件人电话号码 格式(+62 开头)
        'shipper_addr'=>'JL. Pengirim no.88, RT/RW:001/010, Pluit',  //必填,寄件地址
        'origin_code'=>'JKT',   //必填, 寄件城市编码,(区分大小写,大字)
        'receiver_name'=>'PENERIMA',  //必填,收件人名字
        'receiver_phone'=>'+62812348888',  //必填,收件人电话号码 格式(+62 开头)
        'receiver_addr'=>'JL. Penerima no.1, RT/RW:04/07, Sidoarjo',  //必填,收件人地址
        'receiver_zip'=>'40123',  //必填,收件人邮政编码
        'receiver_area'=>'SDA001',  //必填,收件人区域编码
        'destination_code'=>'SDA',  //必填, 目的地城市编码 (区分大小写,大字)
        'qty'=>'1',  //必填,件数
        'weight'=>'1',  //必填,重量(单位为克)
        'goodsdesc'=>'TESTING!!',  //必填,描述此件里面是什么东西
        'servicetype'=>'1', //可空,服务类型, “1”取件; ”6“上门取件
        'insurance'=>'50000', //可空,保险
        'item_name'=>'topi', //可空,描述此件里面是什么东西
        'cod'=>'200000', //可空, COD 价值 (印尼币)
    ];
    Yii::$app->express->onlineOrder($params);


    Yii::$app->express->cancelOrder('123765', '备注可为空');

php composer.phar