PHP code example of philipnewcomer / linkify-tracking

1. Go to this page and download the library: Download philipnewcomer/linkify-tracking library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

philipnewcomer / linkify-tracking example snippets


$linkifyTracking = new PhilipNewcomer\LinkifyTracking\LinkifyTracking;

$linkifyTracking->getLinkUrl('12345678901234567890');

$linkifyTracking->getLinkData('12345678901234567890');

[
    '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)

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