PHP code example of thegrommet / sps-connector

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

    

thegrommet / sps-connector example snippets


use SpsConnector\Document\ShippingLabel;
use SpsConnector\LabelService;

$labelDocument = new ShippingLabel();
$label = $labelDocument->addLabel();
// add label specifics

$service = new LabelService('username', 'password');
$pdf = $service->getLabel($labelDocument->__toString(), '5311', $service::FORMAT_PDF);
file_put_contents('label.pdf', $pdf);