PHP code example of harm-smits / sendcloud-shipping-api

1. Go to this page and download the library: Download harm-smits/sendcloud-shipping-api 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/ */

    

harm-smits / sendcloud-shipping-api example snippets


$client = new \HarmSmits\SendCloudClient\Client(
    "...",
    "..."
);

$cursor = null;
while (($result = $client->getParcels($cursor))) {
    $cursor = $result->getNext();
    foreach ($result->getParcels() as $parcel) {
        ...
    }
}

foreach ($client->getParcelStatuses() as $parcelStatus) {
    ...
}

$cursor = null;
while (($result = $client->getBrands($cursor))) {
    $cursor = $result->getNext();
    foreach ($result->getBrands() as $brand) {
        ...
    }
}

$promise = $client->asyncGetParcelStatuses();
...
$result = $promise->wait();