PHPackages                             finecho/logistics - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. finecho/logistics

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

finecho/logistics
=================

A logistics SDK.

3.1.1(4y ago)18729.3k29[4 issues](https://github.com/finecho/logistics/issues)[2 PRs](https://github.com/finecho/logistics/pulls)1MITPHPCI failing

Since May 17Pushed 3y ago2 watchersCompare

[ Source](https://github.com/finecho/logistics)[ Packagist](https://packagist.org/packages/finecho/logistics)[ RSS](/packages/finecho-logistics/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (3)Versions (17)Used By (1)

❤️ Logistics
============

[](#️-logistics)

快递物流查询-快递查询接口组件。

[![Build Status](https://camo.githubusercontent.com/5bb36614022146b85b81757f9d0694027b438bed8579735bb0d43ce262e38ebe/68747470733a2f2f7472617669732d63692e6f72672f66696e6563686f2f6c6f676973746963732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/finecho/logistics)[![Latest Stable Version](https://camo.githubusercontent.com/a9ba8e65aa9b3f0fdd93d9bad3e458cf06adb451c3f907f8ad7c857844e58123/68747470733a2f2f706f7365722e707567782e6f72672f66696e6563686f2f6c6f676973746963732f762f737461626c65)](https://packagist.org/packages/finecho/logistics)[![Total Downloads](https://camo.githubusercontent.com/184210157f04689695b14bafa1170a072016824987dd409dd641f604281395e9/68747470733a2f2f706f7365722e707567782e6f72672f66696e6563686f2f6c6f676973746963732f646f776e6c6f616473)](https://packagist.org/packages/finecho/logistics)[![Latest Unstable Version](https://camo.githubusercontent.com/65108e5577f9d0248d3aef6c7d254f980d704bccd814c711ae8d55905c337c34/68747470733a2f2f706f7365722e707567782e6f72672f66696e6563686f2f6c6f676973746963732f762f756e737461626c65)](https://packagist.org/packages/finecho/logistics)[![License](https://camo.githubusercontent.com/313ffc9916e32a3adfd44e34b498222f13ccdb0eef93e18dcb1762d7ba5c49fc/68747470733a2f2f706f7365722e707567782e6f72672f66696e6563686f2f6c6f676973746963732f6c6963656e7365)](https://packagist.org/packages/finecho/logistics)

介绍
--

[](#介绍)

目前已支持四家平台

- [阿里云](https://homenew.console.aliyun.com/)
- [聚合数据](https://www.juhe.cn/docs/api/id/43)
- [快递100](https://www.kuaidi100.com/)
- [快递鸟](https://www.kdniao.com/)

安装
--

[](#安装)

```
$ composer require finecho/logistics -vvv

```

使用
--

[](#使用)

```
require __DIR__ .'/vendor/autoload.php';

use Finecho\Logistics\Logistics;

$config = [
    'provider' => 'aliyun', // aliyun/juhe/kd100

    'aliyun' => [
        'app_code' => 'xxxxxxxx',
    ],

    'juhe' => [
         'app_code' => 'xxxxx',
    ],

    'kdniao' => [
             'app_code' => 'xxxxx',
             'customer' => 'xxxxx',
    ],

    'kd100' => [
         'app_code' => 'xxxxx',
         'customer' => 'xxxxx',
    ],
];

$logistics = new Logistics($config);
```

### 获取物流公司列表

[](#获取物流公司列表)

```
$companies = $logistics->companies();
```

示例:

```
[
    "顺丰",
    "申通",
    "中通",
    "圆通"
]
```

### 获取物流信息

[](#获取物流信息)

```
$order = $logistics->query('805741929402797742', '圆通');
```

示例：

```
{
    "code": 200,
    "msg": "OK",
    "company": "圆通",
    "no": "805741929402797742",
    "status": 4,
    "display_status": "已签收",
    "abstract_status": {
        "has_active" : true,
        "has_ended" : true,
        "has_signed" : true,
        "has_troubled" : false,
        "has_returned" : false
    },
    "list": [
        {
            "datetime": "2019-05-07 18:02:27",
            "remark": "山东省淄博市淄川区三部公司取件人:司健（15553333300）已收件",
            "zone": ""
        },
        {
            "datetime": "2019-05-09 12:44:40",
            "remark": "快件已签收签收人:邮件收发章感谢使用圆通速递，期待再次为您服务",
            "zone": ""
        }
    ],
    "original": {
        "resultcode": "200",
        "reason": "成功的返回",
        "result": {
            "company": "圆通",
            "com": "yt",
            "no": "805741929402797742",
            "status": "1",
            "status_detail": null,
            "list": [
                {
                    "datetime": "2019-05-07 18:02:27",
                    "remark": "山东省淄博市淄川区三部公司取件人:司健（15553333300）已收件",
                    "zone": ""
                },
                {
                    "datetime": "2019-05-09 12:44:40",
                    "remark": "快件已签收签收人:邮件收发章感谢使用圆通速递，期待再次为您服务",
                    "zone": ""
                }
            ]
        },
        "error_code": 0
    }
}
```

你也可以这样获取：

```
$order['company']; // '圆通' （因为各个平台对公司的名称有所不一致，所以查询结果或许会有些许差别）
$order['list']; // ....
$order['original']; // 获取接口原始返回信息
...

```

或者这样：

```
$order->getCode(); // 状态码
$order->getMsg(); // 状态信息
$order->getCompany(); // 物流公司简称
$order->getNo(); // 物流单号
$order->getStatus(); // 当前物流单状态

// 注：物流状态可能不一定准确

$order->getDisplayStatus(); // 当前物流单状态展示名
$order->getAbstractStatus(); // 当前抽象物流单状态
$order->getCourier(); // 快递员姓名
$order->getCourierPhone(); // 快递员手机号
$order->getList(); // 物流单状态详情
$order->getOriginal(); // 获取接口原始返回信息

```

### 参数说明

[](#参数说明)

```
 string   order(string $no, string $company = null)

```

> - `$no` - 物流单号
> - `$company` - 快递公司名（通过 $companies = $logistics-&gt;companies(); 获取)

- `aliyun` ：`$company` 可选
- `juhe` : `$company` 必填
- `kd100` : `$company` 可选（建议必填，不填查询结果不一定准确）
- `kdniao` : `$company` 可选（建议必填，不填查询结果不一定准确）

### 在 Laravel 中使用

[](#在-laravel-中使用)

生成配置文件

```
php artisan vendor:publish --provider="Finecho\Logistics\ServiceProvider"
```

然后在 `.env` 中配置 `LOGISTICS_APP_CODE` ，同时修改 config/logistics.php 中配置信息：

```
LOGISTICS_APP_CODE=xxxxxxxxxxxxxxxxx
LOGISTICS_CUSTOMER=xxxxxxxxxxxxxxxxx	// 快递100 customer
```

可以用两种方式来获取 `Finecho\Logistics\Logistics;` 实例：

#### 方法参数注入

[](#方法参数注入)

```
    .
    .
    .
    public function show(Logistics $logistics, $no, $company)
    {
        $order = $logistics->query($no, $company);

        return $order;	// $order->getList(); .....
    }
    .
    .
    .
```

#### 服务名访问

[](#服务名访问)

```
    .
    .
    .
    public function show($no, $company)
    {
        $response = app('logistics')->query($no, $company);
    }
    .
    .
    .
```

参考
--

[](#参考)

- [PHP 扩展包实战教程 - 从入门到发布](https://learnku.com/courses/creating-package)
- [overtrue/easy-sms](https://github.com/overtrue/easy-sms)
- [icecho/easy-ip](https://github.com/icecho/easy-ip)

感谢
--

[](#感谢)

- 感谢 [超哥](https://github.com/overtrue) 和 [icecho](https://github.com/icecho) 为我第一个扩展包的悉心指导。

License
-------

[](#license)

MIT

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity43

Moderate usage in the ecosystem

Community22

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 89.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~67 days

Recently: every ~208 days

Total

15

Last Release

1617d ago

Major Versions

1.0.3 → 2.0.02019-05-24

2.3.1 → 3.0.02019-09-04

### Community

Maintainers

![](https://www.gravatar.com/avatar/4c7d97a405bd4800085229fad21b5c81ead3f09393525289d764f99300b0f1ed?d=identicon)[liuhao](/maintainers/liuhao)

---

Top Contributors

[![thisliu](https://avatars.githubusercontent.com/u/29086766?v=4)](https://github.com/thisliu "thisliu (89 commits)")[![aliliin](https://avatars.githubusercontent.com/u/22074839?v=4)](https://github.com/aliliin "aliliin (5 commits)")[![lw006](https://avatars.githubusercontent.com/u/21253076?v=4)](https://github.com/lw006 "lw006 (2 commits)")[![assert6](https://avatars.githubusercontent.com/u/28561563?v=4)](https://github.com/assert6 "assert6 (1 commits)")[![guanguans](https://avatars.githubusercontent.com/u/22309277?v=4)](https://github.com/guanguans "guanguans (1 commits)")[![overtrue](https://avatars.githubusercontent.com/u/1472352?v=4)](https://github.com/overtrue "overtrue (1 commits)")

---

Tags

logisticslogistics-company

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/finecho-logistics/health.svg)

```
[![Health](https://phpackages.com/badges/finecho-logistics/health.svg)](https://phpackages.com/packages/finecho-logistics)
```

###  Alternatives

[shlinkio/shlink

A self-hosted and PHP-based URL shortener application with CLI and REST interfaces

4.8k4.3k](/packages/shlinkio-shlink)[ralphjsmit/laravel-helpers

A package containing handy helpers for your Laravel-application.

13704.6k2](/packages/ralphjsmit-laravel-helpers)[dhlparcel/magento2-plugin

DHL Parcel plugin for Magento 2

11180.5k2](/packages/dhlparcel-magento2-plugin)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
