PHPackages                             daley/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. daley/logistics

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

daley/logistics
===============

通用快递查询SDK， 支持多家快递查询渠道

1.0.1(5y ago)4273MITPHPPHP &gt;=5.6CI failing

Since Jun 26Pushed 4y ago1 watchersCompare

[ Source](https://github.com/f-dong/logistics)[ Packagist](https://packagist.org/packages/daley/logistics)[ RSS](/packages/daley-logistics/feed)WikiDiscussions master Synced 6d ago

READMEChangelog (1)Dependencies (3)Versions (4)Used By (0)

 logistics
===========

[](#-logistics-)

 一个简单便捷查询运单快递信息的SDK.

[![Build Status](https://camo.githubusercontent.com/814e241e06fbae645914b5487349adbe2eaec9dd46aa1b127ff19d287331af7a/68747470733a2f2f7472617669732d63692e6f72672f662d646f6e672f6c6f676973746963732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/f-dong/logistics)[![StyleCI build status](https://camo.githubusercontent.com/9c2767afb71c74d34b264611c3834f13781cc9099584817fcdeafe362bc91446/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3237343932373730342f736869656c64)](https://github.styleci.io/repos/274927704)[![Latest Stable Version](https://camo.githubusercontent.com/1be415b143886ad8a1cf52490a42e0b2d0890b77a13ff728f2cb1d7cb86e6bed/68747470733a2f2f706f7365722e707567782e6f72672f64616c65792f6c6f676973746963732f76)](//packagist.org/packages/daley/logistics)[![Total Downloads](https://camo.githubusercontent.com/cc2c3786a8c8c1ead65bee1e96b23a07e8ef33acccb23f9d3b79785a76d4bd44/68747470733a2f2f706f7365722e707567782e6f72672f64616c65792f6c6f676973746963732f646f776e6c6f616473)](//packagist.org/packages/daley/logistics)[![Latest Unstable Version](https://camo.githubusercontent.com/c8974ed39b8dbbba0af022f87d194697cc766d7e92d598adbc54a9f96f516f03/68747470733a2f2f706f7365722e707567782e6f72672f64616c65792f6c6f676973746963732f762f756e737461626c65)](//packagist.org/packages/daley/logistics)[![License](https://camo.githubusercontent.com/2299946eb1a7c8e2c3b67236dbc0d08b8db275d6716a15c57f167ccf79318b71/68747470733a2f2f706f7365722e707567782e6f72672f64616c65792f6c6f676973746963732f6c6963656e7365)](//packagist.org/packages/daley/logistics)

支持查询接口平台
--------

[](#支持查询接口平台)

平台调用渠道名是否需要快递公司编码[快递100](https://www.kuaidi100.com/openapi/applyapi.shtml)kuaiDi100Y[快递鸟](http://www.kdniao.com/api-all)kuaiDiBirdY[急速数据](https://www.jisuapi.com/api/express)jiSuN[爱查快递](https://www.ickd.cn/api)icKdN[百度快递](https://www.baidu.com)baiDuN- 爱查快递、百度快递为抓取接口，无法保证数据准确性与稳定性. 无法查询顺丰快递.

环境需求
----

[](#环境需求)

- PHP &gt;= 5.6

安装
--

[](#安装)

```
$ composer require daley/logistics
```

使用
--

[](#使用)

```
use Daley\Logistics\Logistics;

// 使用不到的渠道不传即可
$logistics = new Logistics([
    // 快递100配置
    'kuaidi100' => [
        'app_key' => '',
        'app_secret' => '',
    ],
    // 快递鸟配置
    'kuaidibird' => [
        'app_key' => '', // 用户ID
        'app_secret' => '', // API key
        'vip' => false, // 是否付费用户
    ],
    // 急速快递配置
    'jisu' => [
        'app_key' => ''
    ],
]);

// 查询物流
try {
    var_dump($logistics->query('73129084446868', 'zhongtong'));
} catch (\Daley\Logistics\Exceptions\HttpException $exception) {
    // HTTP请求异常
} catch (\Daley\Logistics\Exceptions\InvalidArgumentException $exception) {
    // 参数异常
} catch (\Daley\Logistics\Exceptions\NoAvailableException $exception) {
    // 没有成功数据
} catch (Exception $exception) {
    // 其他异常
}
```

### 参数说明

[](#参数说明)

```
array query(string $code [, mixed $company = null, string $phone])

```

- $code - 运单号
- $company - 快递公司编码 参考各渠道提供的渠道列表 不填为自动抓取 不保证准确性 多公司时使用数组 如 `['kuaidi100' => 'zhongtong', 'kuaidibird' => 'ZTO']`
- $phone - 寄件 / 收件 手机号码 查询顺丰时需要用到

### 更换查询渠道

[](#更换查询渠道)

```
// 不设置默认使用快递100
$logistics->setChannel('kuaiDiBird')->query('73129084446868');

// 查询多渠道
$logistics->setChannel(['kuaiDi100', 'kuaiDiBird'])->query('73129084446868');
```

返回示例
----

[](#返回示例)

```
//  成功返回
[
   'kuaidi100' => [
       'channel' => 'kuaiDi100',
       'status' => 'success',
       'result' => [
           [
               'status' => 1,
               'message'  => 'ok',
               'error_code' => 0,
               'data' => [
                   ['time' => '2020-06-25 00:00:00', 'description' => '仓库-已签收'],
                   ['time' => '2020-06-25 00:00:00', 'description' => '广东XX服务点'],
                   ['time' => '2020-06-25 00:00:00', 'description' => '广东XX转运中心'],
               ],
               'logistics_company' => 'zhongtong',
           ],
       ]
   ]
]

// 失败返回
[
   'kuaidi100' => [
       'channel' => 'kuaiDi100',
       'status' => 'failure',
       'exception' => '数据不完整',
   ],
]
```

- 所有渠道返回格式均一致

Laravel 中使用
-----------

[](#laravel-中使用)

- 发布配置

```
$ php artisan vendor:publish --provider=Daley\Logistics\Laravel\LogisticsServiceProvider --tag=logistics
```

- 随后，请在`config`文件夹中完善配置信息。
- 方法参数注入

```
public function edit(Logistics $logistics)
{
    $response = $logistics->setChannel('kuaiDi100')->query('73129084446868', 'zhongtong');
}
```

- 服务名访问

```
public function edit()
{
    $response = app('logistics')->setChannel('kuaiDi100')->query('73129084446868', 'zhongtong');
}
```

License
-------

[](#license)

MIT

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~187 days

Total

3

Last Release

1777d ago

Major Versions

1.0.1 → 2.0.x-dev2021-07-06

### Community

Maintainers

![](https://www.gravatar.com/avatar/44a0ed31b593669977295a2bfc84fce4417cb1bc6a7351cfd5cbd7f4e3ee9894?d=identicon)[daley](/maintainers/daley)

---

Top Contributors

[![mintfog](https://avatars.githubusercontent.com/u/40230452?v=4)](https://github.com/mintfog "mintfog (9 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

```
[![Health](https://phpackages.com/badges/daley-logistics/health.svg)](https://phpackages.com/packages/daley-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)
