PHPackages                             claassenmarius/php-skynet - 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. [API Development](/categories/api)
4. /
5. claassenmarius/php-skynet

ActiveLibrary[API Development](/categories/api)

claassenmarius/php-skynet
=========================

A php package to use the Skynet Courier API.

1.0.0(5y ago)05MITPHPPHP ^8.0

Since Jun 21Pushed 5y ago1 watchersCompare

[ Source](https://github.com/claassenmarius/php-skynet)[ Packagist](https://packagist.org/packages/claassenmarius/php-skynet)[ RSS](/packages/claassenmarius-php-skynet/feed)WikiDiscussions main Synced today

READMEChangelog (2)Dependencies (4)Versions (3)Used By (0)

PHP Skynet
==========

[](#php-skynet)

[![Tests](https://github.com/claassenmarius/php-skynet/actions/workflows/run-tests.yml/badge.svg)](https://github.com/claassenmarius/php-skynet/actions/workflows/run-tests.yml)[![Check & fix styling](https://github.com/claassenmarius/php-skynet/actions/workflows/php-cs-fixer.yml/badge.svg)](https://github.com/claassenmarius/php-skynet/actions/workflows/php-cs-fixer.yml)

A framework agnostic php package to use the Skynet Courier API.

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

[](#installation)

Require the package using composer:

```
composer require claassenmarius/php-skynet
```

Usage
-----

[](#usage)

Create an instance of [`Claassenmarius\PhpSkynet\Skynet`](./src/Skynet.php), passing in your skynet username, password, account number and system id.

```
use Claassenmarius\PhpSkynet\Skynet;

$skynet = new Skynet(
  'skynet_username',
  'skynet_password',
  'skynet_system_id',
  'skynet_account_number'
);
```

The following methods are available to [get a security token](#get-a-security-token), [validate a suburb/postcode combination](#validate-a-suburb-and-postal-code-combination), [get a list of postal codes for a suburb](#get-a-list-of-postal-codes-for-a-suburb), [get a quote for a parcel](#get-a-quote-for-a-parcel), [get an ETA between two locations](#get-eta-between-two-locations), [generate a waybill](#generate-a-waybill), [obtain a POD image](#get-a-waybill-pod-image) and [track a waybill](#track-a-waybill). Each method returns a new [`Claassenmarius\PhpSkynet\Response`](./src/Response.php) which [exposes methods](#response) to inspect the response.

### Get a security token

[](#get-a-security-token)

```
$response = $skynet->securityToken();
```

### Validate a suburb and postal code combination

[](#validate-a-suburb-and-postal-code-combination)

```
$response = $skynet->validateSuburbAndPostalCode([
    'suburb' => 'Brackenfell',
    'postal-code' => '7560'
]);
```

### Get a list of postal codes for a suburb

[](#get-a-list-of-postal-codes-for-a-suburb)

```
$response = $skynet->postalCodesFromSuburb('Brackenfell');
```

### Get a quote for a parcel

[](#get-a-quote-for-a-parcel)

```
$response = $skynet->quote([
    'collect-city' => 'Brackenfell',
    'deliver-city' => 'Stellenbosch',
    'deliver-postcode' => '7600',
    'service-type' => 'ON1',
    'insurance-type' => '1',
    'parcel-insurance' => '0',
    'parcel-length' => 10, //cm
    'parcel-width' => 20, // cm
    'parcel-height' => 30, //cm
    'parcel-weight' => 20 //kg
]);
```

### Get ETA between two locations

[](#get-eta-between-two-locations)

```
$response = $skynet->deliveryETA([
    'from-suburb' => 'Brackenfell',
    'from-postcode' => '7560',
    'to-suburb' => 'Stellenbosch',
    'to-postcode' => '7600',
    'service-type' => 'ON1'
]);
```

### Generate a waybill

[](#generate-a-waybill)

```
$response = $skynet->createWaybill([
    "customer-reference" => "Customer Reference",
    "GenerateWaybillNumber" => true,
    "service-type" => "ON1",
    "collection-date" => "2021-06-26",
    "from-address-1" => "3 Janie Street, Ferndale, Brackenfell",
    "from-suburb" => "Brackenfell",
    "from-postcode" => "7560",
    "to-address-1" => "15 Verreweide Street, Universiteitsoord, Stellenbosch",
    "to-suburb" => "Stellenbosch",
    "to-postcode" => "7600",
    "insurance-type" => "1",
    "insurance-amount" => "0",
    "security" => "N",
    "parcel-number" => "1",
    "parcel-length" => 10,
    "parcel-width" => 20,
    "parcel-height" => 30,
    "parcel-weight" => 10,
    "parcel-reference" => "12345",
    "offsite-collection" => true
]);
```

### Get a waybill POD Image

[](#get-a-waybill-pod-image)

```
$response = $skynet->waybillPOD('your-waybill-number');
```

### Track a waybill

[](#track-a-waybill)

```
$response = $skynet->trackWaybill('your-waybill-number');
```

Response
--------

[](#response)

[`Claassenmarius\PhpSkynet\Response`](./src/Response.php) provides the following methods to inspect the response.

### Get the body of the response in string format:

[](#get-the-body-of-the-response-in-string-format)

```
$securityToken = $response->body();
// "{"SecurityToken":"2_f77e4922-1407-485e-a0fa-4fdd5c29e9ca"}"
```

### Get the JSON decoded body of the response as an array or scalar value

[](#get-the-json-decoded-body-of-the-response-as-an-array-or-scalar-value)

```
$securityToken = $response->json();
// ["SecurityToken" => "2_c767aa41-bca8-4084-82a0-69d8e27fba2c"]
```

### Get the JSON decoded body of the response as an object.

[](#get-the-json-decoded-body-of-the-response-as-an-object)

```
$securityToken = $response->object();
// { +"SecurityToken": "2_c767aa41-bca8-4084-82a0-69d8e27fba2c" }
```

### Get a header from the response.

[](#get-a-header-from-the-response)

```
$header = $response->header('Content-Type');
// "application/json; charset=utf-8"
```

### Get the headers from the response.

[](#get-the-headers-from-the-response)

```
$headers = $response->headers();
// Return an array of all headers
```

### Get the status code of the response.

[](#get-the-status-code-of-the-response)

```
$headers = $response->status();
// 200
```

### Determine if the request was successful (Whether status code `>=200` &amp; `successful();
// true
```

### Determine if the response code was "OK". (Status code === `200`)

[](#determine-if-the-response-code-was-ok-status-code--200)

```
$headers = $response->ok();
// true
```

### Determine if server error occurred. (Whether status code `>=500`)

[](#determine-if-server-error-occurred-whether-status-code-500)

```
$headers = $response->serverError();
// false
```

### Determine if client or server error occurred.

[](#determine-if-client-or-server-error-occurred)

```
$headers = $response->failed();
// false
```

Exception Handling
------------------

[](#exception-handling)

This package uses the [Guzzle PHP HTTP client](https://docs.guzzlephp.org/en/stable/index.html) behind the scenes to send requests.

- In the event of a networking error (connection timeout, DNS errors, etc.), a GuzzleHttp\\Exception\\RequestException`is thrown. This exception extends from`GuzzleHttp\\Exception\\TransferException`. Catching this exception will catch any exception that can be thrown while transferring requests.

```
use GuzzleHttp\Psr7;
use GuzzleHttp\Exception\RequestException;

try {
    $response = $skynet->securityToken();
} catch(RequestException $e) {
    // Handle the exception
}
```

- A `GuzzleHttp\Exception\ConnectException` exception is thrown in the event of a networking error. This exception extends from `GuzzleHttp\Exception\TransferException`.
- A `GuzzleHttp\Exception\ClientException` is thrown for 400 level errors if the http\_errors request option is set to true. This exception extends from `GuzzleHttp\Exception\BadResponseException` and `GuzzleHttp\Exception\BadResponseException` extends from `GuzzleHttp\Exception\RequestException`.

```
use GuzzleHttp\Psr7;
use GuzzleHttp\Exception\ClientException;

try {
    $response = $skynet->securityToken();
} catch(ClientException $e) {
    // Handle the exception
}
```

- A `GuzzleHttp\Exception\ServerException` is thrown for 500 level errors if the http\_errors request option is set to true. This exception extends from `GuzzleHttp\Exception\BadResponseException`.

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

License
-------

[](#license)

The MIT Licence (MIT). Please see [Licence File](LICENCE.md) for more information.

###  Health Score

25

—

LowBetter than 35% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

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

Every ~1 days

Total

2

Last Release

1835d ago

Major Versions

0.1.0 → 1.0.02021-06-23

### Community

Maintainers

![](https://www.gravatar.com/avatar/4a3c652c3835a96caa79c55f2c7aa060b284c1b88c78f5ae97f74a085e512752?d=identicon)[claassenmarius](/maintainers/claassenmarius)

---

Top Contributors

[![claassenmarius](https://avatars.githubusercontent.com/u/67523667?v=4)](https://github.com/claassenmarius "claassenmarius (51 commits)")

---

Tags

php-skynetclaassenmarius

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/claassenmarius-php-skynet/health.svg)

```
[![Health](https://phpackages.com/badges/claassenmarius-php-skynet/health.svg)](https://phpackages.com/packages/claassenmarius-php-skynet)
```

###  Alternatives

[statamic/cms

The Statamic CMS Core Package

4.8k3.6M971](/packages/statamic-cms)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3741.3M46](/packages/tencentcloud-tencentcloud-sdk-php)[neuron-core/neuron-ai

The PHP Agentic Framework.

2.0k656.1k38](/packages/neuron-core-neuron-ai)[avalara/avataxclient

Client library for Avalara's AvaTax suite of business tax calculation and processing services. Uses the REST v2 API.

528.5M7](/packages/avalara-avataxclient)[files.com/files-php-sdk

Files.com PHP SDK

2481.1k](/packages/filescom-files-php-sdk)[aimeos/prisma

A powerful PHP package for integrating media related Large Language Models (LLMs) into your applications

1943.1k5](/packages/aimeos-prisma)

PHPackages © 2026

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