PHPackages                             sonnenglas/shiplogic-php-sdk - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. sonnenglas/shiplogic-php-sdk

ActiveLibrary[HTTP &amp; Networking](/categories/http)

sonnenglas/shiplogic-php-sdk
============================

Unofficial PHP SDK for the Shiplogic REST API — the shipping platform behind The Courier Guy and other South African carrier brands. Covers rate quotes, shipments, label PDFs, cancellation, tracking and webhook payloads.

1.0.0(3w ago)018MITPHPPHP &gt;=8.1

Since May 19Pushed 3w agoCompare

[ Source](https://github.com/sonnenglas/shiplogic-php-sdk)[ Packagist](https://packagist.org/packages/sonnenglas/shiplogic-php-sdk)[ RSS](/packages/sonnenglas-shiplogic-php-sdk/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (1)Dependencies (8)Versions (4)Used By (0)

Shiplogic PHP SDK
=================

[](#shiplogic-php-sdk)

Unofficial PHP SDK for the [Shiplogic](https://shiplogic.com) shipping platform — the API behind **The Courier Guy** and other South African carrier brands.

Covers rate quotes, shipment CRUD, label and sticker PDF downloads, cancellation, tracking events, and inbound webhook payloads (`tracking-event`, `shipment-note`, `parcel-dimension-changes`, `shipment-address-changes`). Hand-crafted, dependency-light (Guzzle only), with first-class value objects and response DTOs.

Requirements
------------

[](#requirements)

- PHP 8.1+
- ext-json
- `guzzlehttp/guzzle` ^7.1

Installation
------------

[](#installation)

```
composer require sonnenglas/shiplogic-php-sdk
```

Usage
-----

[](#usage)

```
use Sonnenglas\Shiplogic\Shiplogic;
use Sonnenglas\Shiplogic\ValueObjects\Address;
use Sonnenglas\Shiplogic\ValueObjects\Contact;
use Sonnenglas\Shiplogic\ValueObjects\Parcel;
use Sonnenglas\Shiplogic\ValueObjects\ShipmentRequest;
use Sonnenglas\Shiplogic\Enums\ServiceLevel;
use Sonnenglas\Shiplogic\Enums\AddressType;

// Shiplogic uses a single API host (api.shiplogic.com); sandbox vs production
// is decided by the API token, not the URL. `productionMode` is kept for
// backwards compatibility but no longer changes the base URI.
$shiplogic = new Shiplogic(apiToken: '...');
$shipmentService = $shiplogic->getShipmentService();

$sender = new Address(
    streetAddress: '16 Viljoen Street',
    localArea: 'Lorentzville',
    city: 'Johannesburg',
    zone: 'GP',
    country: 'ZA',
    code: '2094',
    company: 'Sonnenglas',
    type: AddressType::Business,
);

$recipient = new Address(
    streetAddress: '10 Midas Avenue',
    localArea: 'Olympus AH',
    city: 'Pretoria',
    zone: 'GP',
    country: 'ZA',
    code: '0081',
    type: AddressType::Residential,
);

$parcel = new Parcel(lengthCm: 30.0, widthCm: 20.0, heightCm: 10.0, weightKg: 2.0);

$request = new ShipmentRequest(
    collectionAddress: $sender,
    collectionContact: new Contact(name: 'Warehouse Op', mobileNumber: '+27110000000', email: 'ops@example.com'),
    deliveryAddress: $recipient,
    deliveryContact: new Contact(name: 'Jane Doe', mobileNumber: '+27821234567', email: 'jane@example.com'),
    parcels: [$parcel],
    serviceLevelCode: ServiceLevel::Economy,
    customerReference: 'ORDER-123',
);

$response = $shipmentService->createShipment($request);

echo $response->shortTrackingReference;        // e.g. "3BM3"
echo $response->customTrackingReference;       // e.g. "SLX3BM3"

$label = $shipmentService->getLabel($response->id);
echo $label->url;                              // signed S3 URL, valid 24h
```

Services
--------

[](#services)

The `Shiplogic` facade exposes three services:

- `getShipmentService()` — create / fetch / cancel shipments, download label PDFs and sticker labels.
- `getRatesService()` — fetch rate quotes for a collection/delivery pair.
- `getTrackingService()` — fetch a shipment's status and event timeline.

Webhooks
--------

[](#webhooks)

Shiplogic delivers webhooks for `tracking-event`, `shipment-note`, `parcel-dimension-changes`, and `shipment-address-changes` topics. The SDK ships first-class payload DTOs under `Sonnenglas\Shiplogic\Webhooks\*` so consumers can hydrate inbound payloads without re-parsing JSON.

```
use Sonnenglas\Shiplogic\Webhooks\TrackingEventPayload;

$payload = TrackingEventPayload::fromArray(json_decode($request->getBody(), true));
```

Testing
-------

[](#testing)

```
composer install
./vendor/bin/phpunit --testsuite Unit
```

Integration tests are gated on a sandbox token in `tests/.env`:

```
SHIPLOGIC_SANDBOX_TOKEN=your-sandbox-token ./vendor/bin/phpunit --testsuite Integration
```

License
-------

[](#license)

MIT. See LICENSE.

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance95

Actively maintained with recent releases

Popularity9

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

21d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c01b6bd0faf6699a448bcb24a5b86999f5a770ea0f296dc7ade0842ad54836cc?d=identicon)[sonnenglas](/maintainers/sonnenglas)

---

Top Contributors

[![przemekperon](https://avatars.githubusercontent.com/u/169778?v=4)](https://github.com/przemekperon "przemekperon (7 commits)")

---

Tags

phpapiclientrestshippingSouth Africashiplogiccourier-guythecourierguy

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/sonnenglas-shiplogic-php-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/sonnenglas-shiplogic-php-sdk/health.svg)](https://phpackages.com/packages/sonnenglas-shiplogic-php-sdk)
```

###  Alternatives

[onesignal/onesignal-php-api

A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com

34199.5k2](/packages/onesignal-onesignal-php-api)[huaweicloud/huaweicloud-sdk-php

Huawei Cloud SDK for PHP

1830.2k2](/packages/huaweicloud-huaweicloud-sdk-php)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
