PHPackages                             bam-bam-bigelow/shipment-tracker - 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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. bam-bam-bigelow/shipment-tracker

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

bam-bam-bigelow/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.

0.8.7(1y ago)1502MITPHPPHP &gt;=7.1

Since Feb 5Pushed 1y agoCompare

[ Source](https://github.com/bam-bam-bigelow/shipment-tracker)[ Packagist](https://packagist.org/packages/bam-bam-bigelow/shipment-tracker)[ RSS](/packages/bam-bam-bigelow-shipment-tracker/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (8)Dependencies (4)Versions (58)Used By (0)

Shipment Tracker
================

[](#shipment-tracker)

**A simple tool to scrape the parcel tracking data for DHL, DHL Express, GLS, UPS, FedEx USPS, Swiss Post Service and Austria Post Service**

[![Build Status](https://camo.githubusercontent.com/1ffc4edb14b11125111cd2de026505b5a5476757e504a09a26dded50b1a61fe1/68747470733a2f2f7472617669732d63692e6f72672f7361756c6164616d2f736869706d656e742d747261636b65722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/sauladam/shipment-tracker)[![Total Downloads](https://camo.githubusercontent.com/3187a4ee2ed859c39349ce8207cdf378d6f85bdf129406db7b5ddc9e418fe3ca/68747470733a2f2f706f7365722e707567782e6f72672f7361756c6164616d2f736869706d656e742d747261636b65722f646f776e6c6f616473)](https://packagist.org/packages/sauladam/shipment-tracker)

Some parcel services give you a really hard time when it comes to registering some kind of merchant or developer account. All you actually want is to simply keep track of a shipment and have an eye on its status. Yes, you could keep refreshing the tracking pages, but sometimes you've just got better stuff to do.

So here's a tool that does this automatically, without any of the developer-account and API mumbo jumbo. It just simply scrapes the website with the tracking information and transforms the data into an easily consumable format for humans and computers. Let me show you how it works!

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

[](#installation)

Just pull this package in through composer or by adding it to your `composer.json` file:

```
$ composer require sauladam/shipment-tracker
```

Don't forget to run

```
$ composer update

```

after that.

Supported Carriers
------------------

[](#supported-carriers)

The following carriers and languages are currently supported by this package:

- DHL (de, en)
- DHL Express (de, en) (so far only for waybill numbers, not for shipment numbers of the individual pieces)
- GLS (de, en)
- UPS (de, en)
- Fedex (en) (hat tip to [@avrahamappel](https://github.com/avrahamappel))
- USPS (en)
- PostCH (Swiss Post Service) (de, en)
- PostAT (Austria Post Service) (de, en)

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

[](#basic-usage)

```
require_once 'vendor/autoload.php';

use Sauladam\ShipmentTracker\ShipmentTracker;

$dhlTracker = ShipmentTracker::get('DHL');

/* track with the standard settings */
$track = $dhlTracker->track('00340434127681930812');
// scrapes from http://nolp.dhl.de/nextt-online-public/set_identcodes.do?lang=de&idc=00340434127681930812

/* override the standard language */
$track = $dhlTracker->track('00340434127681930812', 'en');
// scrapes from http://nolp.dhl.de/nextt-online-public/set_identcodes.do?lang=en&idc=00340434127681930812

/* pass additional params to the URL (or override the default ones) */
$track = $dhlTracker->track('00340434127681930812', 'en', ['zip' => '12345']);
// scrapes from http://nolp.dhl.de/nextt-online-public/set_identcodes.do?lang=en&idc=00340434127681930812&zip=12345
```

And that's it. Let's check if this parcel was delivered:

```
if($track->delivered())
{
    echo "Delivered to " . $track->getRecipient();
}
else
{
    echo "Not delivered yet, The current status is " . $track->currentStatus();
}
```

#### Possible statuses are:

[](#possible-statuses-are)

- `Track::STATUS_IN_TRANSIT`
- `Track::STATUS_DELIVERED`
- `Track::STATUS_PICKUP`
- `Track::STATUS_EXCEPTION`
- `Track::STATUS_WARNING`
- `Track::STATUS_UNKNOWN`

#### So where is it right now and what's happening with it?

[](#so-where-is-it-right-now-and-whats-happening-with-it)

```
$latestEvent = $track->latestEvent();

echo "The parcel was last seen in " . $latestEvent->getLocation() . " on " . $latestEvent->getDate()->format('Y-m-d');
echo "What they did: " . $latestEvent->description();
echo "The status was " . $latestEvent->getStatus();
```

You can grab an array with the whole event history with `$track->events()`. The events are sorted by date in descending order. The date is a [Carbon](https://github.com/briannesbitt/Carbon) object.

What else?
----------

[](#what-else)

You just want to build up the URL for the tracking website? No problem:

```
$url = $dhlTracker->trackingUrl('00340434127681930812');
// http://nolp.dhl.de/nextt-online-public/set_identcodes.do?lang=de&idc=00340434127681930812
```

Oh, you need it to link to the english version? Sure thing:

```
$url = $dhlTracker->trackingUrl('00340434127681930812', 'en');
// http://nolp.dhl.de/nextt-online-public/set_identcodes.do?lang=en&idc=00340434127681930812
```

*"But wait, what if I need that URL with additional parameteres?"* - Well, just pass them:

```
$url = $dhlTracker->trackingUrl('00340434127681930812', 'en', ['zip' => '12345']);
// http://nolp.dhl.de/nextt-online-public/set_identcodes.do?lang=en&idc=00340434127681930812&zip=12345
```

Other features
--------------

[](#other-features)

### Additional details

[](#additional-details)

Tracks and Events both can hold additional details, accessible via e.g. `$track->getAdditionalDetails('foo')`. Currently, this is only relevant for GLS and UPS:

- **GLS:**

    - `$track->getAdditionalDetails('parcelShop')` gets the parcel shop details and the opening hours if the parcel was delivered to one
- **UPS:**

    - `$track->getAdditionalDetails('accessPoint')` gets the address of the access point if the parcel was delivered to one
    - `$track->getAdditionalDetails('pickupDueDate')` gets the pickup due date as a Carbon instance
- **DHL Express (waybills):**

    - `$track->getAdditionalDetails('pieces')` gets the tracking numbers of the individual pieces that belong to this shipment
    - `$event->getAdditionalDetails('pieces')` gets the tracking numbers of the individual pieces to which this event applies
- **FedEx:**

    - `$track->getAdditionalDetails('totalKgsWgt')` gets the weight of the shipment in kgs if it's returned
    - `$track->getAdditionalDetails('totalLbsWgt')` gets the weight of the shipment in lbs if it's returned

### Data Providers

[](#data-providers)

By default, this package uses Guzzle as well as the PHP Http client (a.k.a. `file_get_contents()`) to fetch the data. You can pass your own provider if you need to, e.g. if you have the page contents chillin' somewhere in a cache. Just make sure that it implements `Sauladam\ShipmentTracker\DataProviders\DataProviderInterface`, which only requires a `get()` method.

Then, you can just pass it to the factory: `$dhlTracker = ShipmentTracker::get('DHL', new CacheDataProvider);`

If you pass your data provider, it's used by default, but you can swap it out later if you want:

```
$dhlTracker->useDataProvider('guzzle');
```

Currently available providers are:

- guzzle
- php
- custom (referring to the provider that you've passed)

Notes
-----

[](#notes)

Please keep in mind that this is just a tool to make your life easier. I do not recommend using it in a critical environment, because, due to the way it works, it can break down as soon as the tracking website where the data is pulled from changes its structure or renames/rephrases the event descriptions. So please **use it at your own risk!**

Also, there's always a chance that a status can not be resolved because the event description is not known by this package, even though the most common events should be resolved correctly.

Also, the tracking data, therefore the data provided by this package, is the property of the carrier (I guess), so under no circumstances you should use it commercially (like selling it or integrating it in a commercial service). It is intended only for personal use.

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance36

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 70.5% 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 ~58 days

Recently: every ~40 days

Total

55

Last Release

582d ago

PHP version history (3 changes)0.2.0PHP &gt;=5.4.0

0.5.7PHP &gt;=5.5.0

0.7.7PHP &gt;=7.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/8bfb562a69aa2fd585b1da66a793a90cac88225c8761ef262628c11767658613?d=identicon)[bam-bam-bigelow](/maintainers/bam-bam-bigelow)

---

Top Contributors

[![sauladam](https://avatars.githubusercontent.com/u/5918276?v=4)](https://github.com/sauladam "sauladam (55 commits)")[![bam-bam-bigelow](https://avatars.githubusercontent.com/u/46587439?v=4)](https://github.com/bam-bam-bigelow "bam-bam-bigelow (7 commits)")[![buckster12](https://avatars.githubusercontent.com/u/22234253?v=4)](https://github.com/buckster12 "buckster12 (5 commits)")[![mluex](https://avatars.githubusercontent.com/u/20678805?v=4)](https://github.com/mluex "mluex (4 commits)")[![slince](https://avatars.githubusercontent.com/u/3785826?v=4)](https://github.com/slince "slince (2 commits)")[![avrahamappel](https://avatars.githubusercontent.com/u/33736292?v=4)](https://github.com/avrahamappel "avrahamappel (2 commits)")[![automatix](https://avatars.githubusercontent.com/u/440005?v=4)](https://github.com/automatix "automatix (2 commits)")[![brianherbert](https://avatars.githubusercontent.com/u/106068?v=4)](https://github.com/brianherbert "brianherbert (1 commits)")

---

Tags

trackingshipmentuspsparceldhlupsglsswiss post

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/bam-bam-bigelow-shipment-tracker/health.svg)

```
[![Health](https://phpackages.com/badges/bam-bam-bigelow-shipment-tracker/health.svg)](https://phpackages.com/packages/bam-bam-bigelow-shipment-tracker)
```

###  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.

9738.8k](/packages/sauladam-shipment-tracker)[spatie/laravel-sitemap

Create and generate sitemaps with ease

2.6k14.6M107](/packages/spatie-laravel-sitemap)[shippo/shippo-php

A PHP library for connecting with multiple carriers (FedEx, UPS, USPS) using Shippo.

1711.8M2](/packages/shippo-shippo-php)[slince/shipment-tracking

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

291.6k4](/packages/slince-shipment-tracking)[webit/gls-tracking

Web-IT GLS Tracking API

1416.3k2](/packages/webit-gls-tracking)[ivanmitrikeski/laravel-shipping

Shipping package for Laravel. Supported providers: CanadaPost, USPS, UPS, FedEx and Purolator.

206.8k2](/packages/ivanmitrikeski-laravel-shipping)

PHPackages © 2026

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