2017 © Pedro Peláez
 

application shipping-service-provider-check

Simple trial-and-error library for testing which shipping provider a tracking number belongs to

image

repat/shipping-service-provider-check

Simple trial-and-error library for testing which shipping provider a tracking number belongs to

  • Thursday, August 4, 2016
  • by repat
  • Repository
  • 1 Watchers
  • 1 Stars
  • 7 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 17 % Grown

The README.md

shipping-service-providers-check

This is a PHP package for finding out, which shipping service provider a tracking ID belongs to. Since it's used for Germany the service providers available here are the main focus. Contributions are welcome!, (*1)

It's theoretically possible that a tracking ID is valid at multiple providers. That's why you get an array back that could contain multiple trues., (*2)

Blog Article (German): https://repat.de/2016/07/herausfinden-zu-welchem-versanddienstleister-eine-tracking-id-gehoert/, (*3)

Supported Providers

How it works

  • Scraping the website, try to enter the tracking ID and see what happens OR
  • Checking the format of the tracking ID with regular expressions

Installation

Available via composer on Packagist:, (*4)

composer require repat/shipping-service-providers-check, (*5)

Usage

Check out src/ShippingServiceProvidersCheck/default_providers.php for configuration., (*6)

use repat\ShippingServiceProvidersCheck\Check;

$check = new Check($trackingId);

// checks all providers, returns an array like 
// [
//   "dhl" => true,
//   "gls" => false,
//    ...
// ]
$check->checkAll();

// replacing providers or with your own providers, see below
$check->checkAll($extraProviders);

// gets all available providers
$check->getProviders();

Replacing providers and adding your own providers

If you want to add your own provider, you can provide checkAll() with an array like this. Any contributions are most welcome., (*7)

// online check
"SPO" => [
        'base_url' => "http://example.com/tracking_id=",
        'search_string' => 'This is the string that will be looked for',
        'filter' => 'HTML tag to look for',
     ],
// format check
"SPF" => [
        'regex' => '/[foo]{1}/'
     ],
// ...

It's a positive lookup, so you will get true if search_string was found in the HTML tag filter. For information on filters, see Goutte., (*8)

For documentation on regular expressions in PHP see preg_match., (*9)

License

Changelog

  • 0.2 added regex for tracking ID recognition and amazon logistics as a provider
  • 0.1.1 adding your own providers
  • 0.1 fixed to working release (dhl, hermes, gls, ups)
  • 0.0.1 initial release for testing

Contact

  • Homepage: https://repat.de
  • e-mail: repat@repat.de
  • Twitter: @repat123

Flattr this git repo, (*10)

The Versions

04/08 2016

dev-master

9999999-dev https://github.com/repat/shipping-service-provider-check

Simple trial-and-error library for testing which shipping provider a tracking number belongs to

  Sources   Download

MIT

The Requires

 

by Avatar repat

shipping tnt tracking fedex ups dhl id number provider scraper goutte parcel dpd hermes gls amzl

04/08 2016

0.2

0.2.0.0 https://github.com/repat/shipping-service-provider-check

Simple trial-and-error library for testing which shipping provider a tracking number belongs to

  Sources   Download

MIT

The Requires

 

by Avatar repat

shipping tnt tracking fedex ups dhl id number provider scraper goutte parcel dpd hermes gls amzl

28/07 2016

0.1

0.1.0.0 https://github.com/repat/shipping-service-provider-check

Simple trial-and-error library for testing which shipping provider a tracking number belongs to

  Sources   Download

MIT

The Requires

 

by Avatar repat

shipping tnt tracking fedex ups dhl id number provider scraper goutte parcel dpd hermes gls