2017 © Pedro Peláez
 

library linkify-tracking

Linkifies package tracking numbers for DHL, FedEx, UPS, and USPS

image

philipnewcomer/linkify-tracking

Linkifies package tracking numbers for DHL, FedEx, UPS, and USPS

  • Wednesday, May 30, 2018
  • by philipnewcomer
  • Repository
  • 1 Watchers
  • 1 Stars
  • 405 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 3 Versions
  • 10025 % Grown

The README.md

linkify-tracking

Linkifies package tracking numbers for DHL, FedEx, Royal Mail (UK), UPS, and USPS., (*1)

Installation

composer require philipnewcomer/linkify-tracking

Usage

First instantiate an instance of the library:, (*2)

$linkifyTracking = new PhilipNewcomer\LinkifyTracking\LinkifyTracking;

Get the tracking URL for a single tracking number

$linkifyTracking->getLinkUrl('12345678901234567890');

Result:, (*3)

https://tools.usps.com/go/TrackConfirmAction?tLabels=12345678901234567890
$linkifyTracking->getLinkData('12345678901234567890');

Result:, (*4)

[
    'carrier' => 'USPS',
    'url' => 'https://tools.usps.com/go/TrackConfirmAction?tLabels=12345678901234567890'
]
$content = '
Here is a tracking number: 12345678901234567890
And another tracking number: 12345678901234567890
';
$linkifyTracking->linkify($content)

Result:, (*5)

Here is a tracking number: <a href="https://tools.usps.com/go/TrackConfirmAction?tLabels=12345678901234567890">12345678901234567890</a>
And another tracking number: <a href="https://tools.usps.com/go/TrackConfirmAction?tLabels=12345678901234567890">12345678901234567890</a>

Configuration

Configuration arguments may be passed to the LinkifyTracking constructor., (*6)

The following arguments may be provided: * linkAttributes: An array of attributes which should be added to the generated HTML links, (*7)

Example:, (*8)

$linkifyTracking = new PhilipNewcomer\LinkifyTracking\LinkifyTracking([
    'linkAttributes' => [
        'class' => 'tracking-link',
        'target' => '_blank'
    ]
]);

Credits

Tracking number regular expressions for DHL, FedEx, UPS, and USPS are taken from https://github.com/darkain/php-tracking-urls., (*9)

The Versions

30/05 2018

dev-master

9999999-dev

Linkifies package tracking numbers for DHL, FedEx, UPS, and USPS

  Sources   Download

GPL-3.0

30/05 2018

1.1.0

1.1.0.0

Linkifies package tracking numbers for DHL, FedEx, UPS, and USPS

  Sources   Download

GPL-3.0

24/05 2018

1.0.0

1.0.0.0

Linkifies package tracking numbers for DHL, FedEx, UPS, and USPS

  Sources   Download

GPL-3.0