PHPackages                             claassenmarius/laravel-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. claassenmarius/laravel-skynet

ActiveLibrary

claassenmarius/laravel-skynet
=============================

A laravel package to use the Skynet Courier API

1.1.1(4y ago)015MITPHPPHP ^8.0

Since Jun 25Pushed 4y ago1 watchersCompare

[ Source](https://github.com/claassenmarius/laravel-skynet)[ Packagist](https://packagist.org/packages/claassenmarius/laravel-skynet)[ RSS](/packages/claassenmarius-laravel-skynet/feed)WikiDiscussions main Synced 3d ago

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

Laravel Skynet
==============

[](#laravel-skynet)

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

A Laravel package to use the Skynet Courier API.

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

[](#installation)

Require the package using composer:

```
composer require claassenmarius/laravel-skynet
```

Usage
-----

[](#usage)

Add the following environment variables to your `.env` file and add your Skynet account username, password, system id and account number.

```
SKYNET_ACCOUNT_USERNAME=
SKYNET_ACCOUNT_PASSWORD=
SKYNET_SYSTEM_ID=
SKYNET_ACCOUNT_NUMBER=

```

You can obtain an instance of `Claassenmarius\LaravelSkynet\Skynet` in any of the following ways:

### Type-hinting / Dependency injection

[](#type-hinting--dependency-injection)

When type-hinting `Skynet` in a method, Laravel will automatically resolve it from the IOC container for you.

```
use Claassenmarius\LaravelSkynet\Skynet;

class QuoteController extends Controller
{
    public function __invoke(Skynet $skynet)
    {
        $response = $skynet->quote(...);

        // do somethin with the $response
    }
}
```

### Facade

[](#facade)

You can use the `Skynet` Facade.

```
use Claassenmarius\LaravelSkynet\Facades\Skynet;

class QuoteController extends Controller
{
    public function __invoke()
    {
        $response = Skynet::quote(...);

        // do somethin with the $response
    }
}
```

### Manually resolving it from the IOC container

[](#manually-resolving-it-from-the-ioc-container)

```
use Claassenmarius\LaravelSkynet\Skynet;

class QuoteController extends Controller
{
    public function __invoke()
    {
        $skynet = app()->make(Skynet::class);

        $response = $skynet->quote(...);

        // do somethin with the $response
    }
}
```

### Manual instantiation

[](#manual-instantiation)

If you plan on instantiating `Skynet` manually throughout your project it won't be neccessary to add your Skynet credentials to the `.env` file. Instead, pass your credentials to the constructor.

```
use Claassenmarius\LaravelSkynet\Skynet;

class QuoteController extends Controller
{
    public function __invoke()
    {
        $skynet = new Skynet(
          'skynet_username',
          'skynet_password',
          'skynet_system_id',
          'skynet_account_number'
        );

        $response = $skynet->quote(...);

        // do somethin with the $response
    }
}
```

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 `Illuminate\Http\Client\Response` 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)

`Illuminate\Http\Client\Response` provides the following methods to inspect the response.

### Get the body of the response as a string:

[](#get-the-body-of-the-response-as-a-string)

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

### Get the JSON decoded body of the response as an array or scalar value (if a $key is passed in)

[](#get-the-json-decoded-body-of-the-response-as-an-array-or-scalar-value-if-a-key-is-passed-in)

```
$securityToken = $response->json($key);
// ["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 the JSON decoded body of the response as a collection.

[](#get-the-json-decoded-body-of-the-response-as-a-collection)

```
$securityToken = $response->collect($key);
```

### Get a header from the response.

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

```
$header = $response->header($header);
// "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
```

You can inspect the Laravel documentation for more information on the methods that `Illuminate\Http\Client\Response` provide.

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

[](#exception-handling)

This package uses Laravel's Http Client behind the scenes, which does not throw exceptions on client or server errors (400 and 500 level responses from servers). You may determine if one of these errors was returned using the successful, clientError, or serverError methods.

If you have a response instance and would like to throw an instance of `Illuminate\Http\Client\RequestException` if the response status code indicates a client or server error, you may use the throw method:

```
response = $skynet->quote(...);

if($response->failed()) {
// Throw an exception if a client or server error occurred...
  $response->throw();
}
```

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 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

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

3

Last Release

1781d ago

### 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 (34 commits)")

---

Tags

laravelclaassenmariusskynetlaravel-skynet

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[laravel/socialite

Laravel wrapper around OAuth 1 &amp; OAuth 2 libraries.

5.7k96.9M674](/packages/laravel-socialite)[spatie/laravel-health

Monitor the health of a Laravel application

85810.0M83](/packages/spatie-laravel-health)[laravel-notification-channels/telegram

Telegram Notifications Channel for Laravel

1.1k3.4M35](/packages/laravel-notification-channels-telegram)[omniphx/forrest

A Laravel library for Salesforce

2724.4M8](/packages/omniphx-forrest)[tpetry/laravel-mysql-explain

Get Visual MySQL EXPLAIN for Laravel.

264154.2k](/packages/tpetry-laravel-mysql-explain)[bensampo/laravel-embed

Painless responsive embeds for videos, slideshows and more.

142146.8k](/packages/bensampo-laravel-embed)

PHPackages © 2026

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