1. Go to this page and download the library: Download germania-kg/shipping 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 / shipping example snippets
use Germania\Shipping\ShipmentItem;
use Germania\Tracking\TrackingInfo;
// Prepare components
$tracking_info = new TrackingInfo;
$tracking_info->setTrackingID("foo");
$tracking_info->setTrackingLink("https://track.test.com/?id=foo");
// Use setters
$item = new ShipmentItem;
$item->setDeliveryNoteNumber( "123456" );
$item->setTrackingInfo( $tracking_info );
// Use getters
echo $item->getDeliveryNoteNumber(); // "123456"
echo $item->getTrackingInfo()->getTrackingLink(); // "https://track.test.com/?id=foo"
echo $item->getTrackingInfo()->getTrackingID(); // "foo"
use Germania\Shipping\ShipmentItemFactory;
use Germania\Shipping\ShipmentItemInterface;
$item_factory = new ShipmentItemFactory;
$item = $item_factory->fromArray([
'delivery_note_number' => '123456',
'tracking_id' => 'foo',
'tracking_link' => 'https://track.test.com/?id=foo'
]);
echo ($item instanceOf ShipmentItemInterface)
? "OK" : "huh?";
use Germania\Shipping\ShipmentItemBundle;
// Prepare
$item1 = new ShipmentItem; #...
$item2 = new ShipmentItem; #...
$items = array(
$item1,
$item2
);
// Setup bundle
$description = "Optional: textual desription";
$bundle = new ShipmentItemBundle( $items, $description);
$bundle = new ShipmentItemBundle( $items);
// Add item
$bundle->push( new ShipmentItem );
// Play
$array = $bundle->getDeliveryNoteNumbers();
echo $bundle->getDescription();
echo count( $bundle ); // int 3
foreach ($bundle as $item) {
echo $item->getDeliveryNoteNumber();
}
echo json_encode( $bundle );
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.