PHP code example of germania-kg / tracking

1. Go to this page and download the library: Download germania-kg/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/ */

    

germania-kg / tracking example snippets



use Germania\Tracking\TrackingInfo;

$ti = new TrackingInfo;
$ti->setTrackingID( "123456" );
$ti->setTrackingLink( "https://parcels.test.com?id=123456" );

echo $ti->getTrackingID();   // "123456"
echo $ti->getTrackingLink(); // "https://parcels.test.com?id=123456"

$ti = new TrackingInfo;
$ti->setTrackingID( "123456" );
$ti->setTrackingLink( "https://parcels.test.com?id=123456" );

// As array:
$array = $ti->jsonSerialize();
echo $array['id'];   // "123456"
echo $array['href']; // "https://parcels.test.com?id=123456"

// StdClass:
$encoded = json_encode( $ti );
$decoded = json_decode( $encoded );

echo $decoded->id;   // "123456"
echo $decoded->href; // "https://parcels.test.com?id=123456"