wjxcodes/express

聚合数据快递查询扩展.

1.0.0 2019-07-13 11:58 UTC

This package is auto-updated.

Last update: 2025-06-19 21:32:24 UTC


README

聚合数据快递查询扩展。

安装

$ composer require wjxcodes/express -vvv

配置

在使用本扩展之前,你需要去 聚合数据 注册账号,然后申请使用物流查询接口,获取应用的 AppKey。

使用

use Wjxcodes\Express\Express;

$appkey = 'xxxxxxxxxxxxxxxxxxxxxxxxxxx';

$weather = new Express($appkey);

获取物流信息

参数说明

com必填,物流公司编号 no必填,物流单号 receiverPhone,非必填,收件人手机号后四位,顺丰快递需要此参数

$response = $express->getExpressInfo($com,$no,$receiverPhone);

在 Laravel 中使用

在 Laravel 中使用也是同样的安装方式,配置写在 config/services.php 中:

    .
    .
    .
     'express' => [
        'key' => env('JUHE_EXPRESS_APP_KEY'),
    ],

然后在 .env 中配置 JUHE_EXPRESS_APP_KEY

JUHE_EXPRESS_APP_KEY=xxxxxxxxxxxxxxxxxxxxx

可以用两种方式来获取 Wjxcodes\Express\Express 实例:

方法参数注入

    .
    .
    .
    public function query(Express $express) 
    {
        $response = $express->getExpressInfo($com,$no,$receiverPhone);
    }
    .
    .
    .

服务名访问

    .
    .
    .
    public function query() 
    {
        $response = app('express')->getExpressInfo($com,$no,$receiverPhone);
    }
    .
    .
    .