# express **Repository Path**: wjxcodes/express ## Basic Information - **Project Name**: express - **Description**: 聚合数据物流查询扩展包 - **Primary Language**: PHP - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2019-07-16 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README

express

聚合数据快递查询扩展。

## 安装 ```shell $ composer require wjxcodes/express -vvv ``` ## 配置 在使用本扩展之前,你需要去 [聚合数据](https://www.juhe.cn/docs/api/id/43) 注册账号,然后申请使用物流查询接口,获取应用的 AppKey。 ## 使用 ```php use Wjxcodes\Express\Express; $appkey = 'xxxxxxxxxxxxxxxxxxxxxxxxxxx'; $weather = new Express($appkey); ``` ### 获取物流信息 #### 参数说明 `com`必填,物流公司编号 `no`必填,物流单号 `receiverPhone`,非必填,收件人手机号后四位,顺丰快递需要此参数 ```php $response = $express->getExpressInfo($com,$no,$receiverPhone); ``` * * * ### 在 Laravel 中使用 在 Laravel 中使用也是同样的安装方式,配置写在 `config/services.php` 中: ```php . . . 'express' => [ 'key' => env('JUHE_EXPRESS_APP_KEY'), ], ``` 然后在 `.env` 中配置 `JUHE_EXPRESS_APP_KEY` : ```env JUHE_EXPRESS_APP_KEY=xxxxxxxxxxxxxxxxxxxxx ``` 可以用两种方式来获取 `Wjxcodes\Express\Express` 实例: #### 方法参数注入 ```php . . . public function query(Express $express) { $response = $express->getExpressInfo($com,$no,$receiverPhone); } . . . ``` #### 服务名访问 ```php . . . public function query() { $response = app('express')->getExpressInfo($com,$no,$receiverPhone); } . . . ```