A flexible and shipment tracking library for multi carriers.

1.1.0 2017-10-31 09:39 UTC

This package is auto-updated.

Last update: 2024-07-08 18:58:49 UTC


Build Status Coverage Status Latest Stable Version Scrutinizer

A flexible and shipment tracking library for multi carriers.

Basic Usage

$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\Exception\TrackException $exception) {
    exit('Track error: ' . $exception->getMessage());

How to create your own tracker?

All shipment trackers must implement Slince\ShipmentTracking\Foundation\TrackerInterface, and will usually extend Slince\ShipmentTracking\Foundation\HttpAwareTracker for basic functionality if the carrier's api is based on HTTP

namespace My\Tracker;

use Slince\ShipmentTracking\Foundation\HttpAwareTracker;
use Slince\ShipmentTracking\Foundation\Shipment;

class MyTracker extends HttpAwareTracker
    * {@inheritdoc}
    public function track($trackingNumber)
        $response = $this->getHttpClient()->get('/../endpoint', [
            'query' => [
                'tracking_number' => $trackingNumber
        return static::buildShipment($response):
     * @return Shipment
    public function buildShipment($response)

$tracker = new MyTracker();
$shipment = $tracker->track('foo-tracking-number');


You can extend all existing classes if you need.

Shipment trackers:

The following carriers are available:

Tracker Composer Package Maintainer
DHL eCommerce slince/shipment-tracking Tao
Yanwen Exprerss(燕文物流) slince/shipment-tracking Tao
快递100 slince/shipment-tracking Tao
E邮宝/E包裹/E特快/国际EMS slince/shipment-tracking Tao


The MIT license. See MIT