PHPackages                             slince/shipment-tracking - 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. slince/shipment-tracking

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

slince/shipment-tracking
========================

A flexible and awesome shipment tracking library for several carriers like DHL eCommerce, USPS, YanWen Express, Epacket, E包裹, E特快, 国际EMS, 快递100

2.2.4(8y ago)271.6k9[1 issues](https://github.com/slince/shipment-tracking/issues)4MITPHPPHP &gt;=5.6.0

Since Jul 27Pushed 7y ago4 watchersCompare

[ Source](https://github.com/slince/shipment-tracking)[ Packagist](https://packagist.org/packages/slince/shipment-tracking)[ RSS](/packages/slince-shipment-tracking/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependencies (4)Versions (14)Used By (4)

Shipment Tracking SDK
=====================

[](#shipment-tracking-sdk)

[![Build Status](https://camo.githubusercontent.com/f47b241c61be9e938a392788ec76620c402e59fd02261a14ea08795bee622365/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f736c696e63652f736869706d656e742d747261636b696e672f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/slince/shipment-tracking)[![Coverage Status](https://camo.githubusercontent.com/9f1d4d4299540e25d6b4ae6aebee668945d470ba6d7f22feaaac1843bf279ad3/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f736c696e63652f736869706d656e742d747261636b696e672e7376673f7374796c653d666c61742d737175617265)](https://codecov.io/github/slince/shipment-tracking)[![Latest Stable Version](https://camo.githubusercontent.com/2df080bfc3c6afd7649685a672d6ec9a65d15d89a8e46de4c84e098343d3c7f6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f736c696e63652f736869706d656e742d747261636b696e672e7376673f7374796c653d666c61742d737175617265266c6162656c3d737461626c65)](https://packagist.org/packages/slince/shipment-tracking)[![Scrutinizer](https://camo.githubusercontent.com/0e75df7f3cec2e3ad9efe963ca27ccd805be71d009249adca7b69c5f53f12440/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f736c696e63652f736869706d656e742d747261636b696e672e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/slince/shipment-tracking/?branch=master)

A flexible and awesome shipment tracking library for several carriers like DHL eCommerce, YanWen Express, Epacket, E包裹, E特快, 国际EMS, 快递100

Installation
------------

[](#installation)

Install via composer

```
$ composer require slince/shipment-tracking
```

Table of Contents
-----------------

[](#table-of-contents)

- [DHL eCommerce](#dhl-ecommerce)
- [YanWen Express(燕文物流)](#yanwen-express%E7%87%95%E6%96%87%E7%89%A9%E6%B5%81)
- [E邮宝(Epacket、EUP)、E包裹、E特快、国际EMS](#%E4%B8%AD%E5%9B%BD%E9%82%AE%E6%94%BF)
- [快递100](#%E5%BF%AB%E9%80%92100)
- [USPS](#usps)
- [递四方](#%E9%80%92%E5%9B%9B%E6%96%B9)

Basic Usage
-----------

[](#basic-usage)

### DHL eCommerce

[](#dhl-ecommerce)

```
$tracker = new Slince\ShipmentTracking\DHLECommerce\DHLECommerceTracker(CLIENT_ID, PASSWORD);

try {
   $shipment = $tracker->track('CNAQV100168101');

   if ($shipment->isDelivered()) {
       echo "Delivered";
   }
   echo $shipment->getOrigin();
   echo $shipment->getDestination();
   print_r($shipment->getEvents());  //print the shipment events

} catch (Slince\ShipmentTracking\Foundation\Exception\TrackException $exception) {
    exit('Track error: ' . $exception->getMessage());
}
```

The above code will get access token automatically for shipment information.

#### Access Token

[](#access-token)

```
$shipment = $tacker->track('CNAQV100168101);
$accessToken = $tracker->getAccessToken(); //You can save this for the next query

//... to do

try{
    $tracker->setAccessToken($accessToken); //Set the access token; the tracker will not send requst for the access token
    $shipment = $tacker->track('CNAQV100168101);
} catch (Slince\ShipmentTracking\DHLECommerce\Exception\InvalidAccessTokenException $exception) {
     $accessToken = $tracker->getAccessToken(true); // If the access token is invalid, refresh it.
     $shipment = $tacker->track('CNAQV100168101);
     //... to do
} catch (Slince\ShipmentTracking\Foundation\Exception\TrackException $exception) {
    exit('Track error: ' . $exception->getMessage());
}
```

### YanWen Express(燕文物流)

[](#yanwen-express燕文物流)

```
$tracker = new Slince\ShipmentTracking\YanWenExpress\YanWenTracker(KEY, 'en');

try {
   $shipment = $tracker->track('CNAQV100168101');

   if ($shipment->isDelivered()) {
       echo "Delivered";
   }
   echo $shipment->getOrigin();
   echo $shipment->getDestination();
   print_r($shipment->getEvents());  //print the shipment events

} catch (Slince\ShipmentTracking\Foundation\Exception\TrackException $exception) {
    exit('Track error: ' . $exception->getMessage());
}
```

### 中国邮政

[](#中国邮政)

适用中邮旗下E邮宝(Epacket、EUP)、E包裹、E特快、国际EMS产品

```
$tracker = new Slince\ShipmentTracking\EMS\EMSTracker(AUTHENTICATE, 'en');

try {
   $shipment = $tracker->track('CNAQV100168101');

   print_r($shipment->getEvents());  //print the shipment events

} catch (Slince\ShipmentTracking\Foundation\Exception\TrackException $exception) {
    exit('Track error: ' . $exception->getMessage());
}
```

注意：该库并不支持查询国内EMS包裹信息，相关文档主页

### 快递100

[](#快递100)

```
$tracker = new Slince\ShipmentTracking\KuaiDi100\KuaiDi100Tracker(APPKEY, 'shunfeng'); //承运商名称并不是标准的承运商代码，实际承运商代码请到kuaidi100.com查看

try {
   $shipment = $tracker->track('CNAQV100168101');

   if ($shipment->isDelivered()) {
       echo "Delivered";
   }
   print_r($shipment->getEvents());  //print the shipment events

} catch (Slince\ShipmentTracking\Foundation\Exception\TrackException $exception) {
    exit('Track error: ' . $exception->getMessage());
}
```

快递100的key需要自行申请，免费版的key在查询申通顺丰之类的单号时会受限，需要企业版才可以；附上快递100[文档](https://www.kuaidi100.com/openapi/api_post.shtml)

### USPS

[](#usps)

```
$tracker = new Slince\ShipmentTracking\USPS\USPSTracker(USER_ID);

try {
   $shipment = $tracker->track('CNAQV100168101');

   if ($shipment->isDelivered()) {
       echo "Delivered";
   }
   print_r($shipment->getEvents());  //print the shipment events

} catch (Slince\ShipmentTracking\Foundation\Exception\TrackException $exception) {
    exit('Track error: ' . $exception->getMessage());
}
```

You can get your user id on the following url.

### 递四方

[](#递四方)

```
$tracker = new Slince\ShipmentTracking\FourPartyExpress\FourPartyExpressTracker(APPKEY, APPSECRET);

try {
   $shipment = $tracker->track('CNAQV100168101');

   print_r($shipment->getEvents());  //print the shipment events

} catch (Slince\ShipmentTracking\Foundation\Exception\TrackException $exception) {
    exit('Track error: ' . $exception->getMessage());
}
```

APPKEY和APPSECRET 需要到递四方官网注册APP,审核之后即可获取到该参数；

License
-------

[](#license)

The MIT license. See [MIT](https://opensource.org/licenses/MIT)

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity27

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity65

Established project with proven stability

 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 ~9 days

Total

13

Last Release

3144d ago

Major Versions

1.0.0 → 2.0.0-beta12017-08-09

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3785826?v=4)[Tao](/maintainers/slince)[@slince](https://github.com/slince)

---

Top Contributors

[![slince](https://avatars.githubusercontent.com/u/3785826?v=4)](https://github.com/slince "slince (41 commits)")

---

Tags

china-postdhl-ecommerceepacketparcelshipmentshipment-trackertrackinguspstrackingshipmentEMSuspstrackerparceldhle快递100kuaidi100ePacketDHL eCommerceyanwen express

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/slince-shipment-tracking/health.svg)

```
[![Health](https://phpackages.com/badges/slince-shipment-tracking/health.svg)](https://phpackages.com/packages/slince-shipment-tracking)
```

###  Alternatives

[sauladam/shipment-tracker

Parses tracking information for several carriers, like UPS, USPS, DHL and GLS by simply scraping the data. No need for any kind of API access.

9642.0k](/packages/sauladam-shipment-tracker)[japanese-date/japanese-date

日本の暦、祝日を取り扱うライブラリ

169.9k](/packages/japanese-date-japanese-date)

PHPackages © 2026

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