PHPackages                             yusufthedragon/shipper-php - 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. yusufthedragon/shipper-php

ActiveLibrary[API Development](/categories/api)

yusufthedragon/shipper-php
==========================

PHP Clients for Shipper API

1.0.1(3y ago)11.4k1GPL-3.0-onlyPHPPHP &gt;=7.2.0

Since Nov 16Pushed 3y ago1 watchersCompare

[ Source](https://github.com/yusufthedragon/shipper-php)[ Packagist](https://packagist.org/packages/yusufthedragon/shipper-php)[ RSS](/packages/yusufthedragon-shipper-php/feed)WikiDiscussions master Synced 2d ago

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

Shipper API PHP Client
======================

[](#shipper-api-php-client)

Unofficial library for access [Shipper](http://shipper.id) API from applications written with PHP.

- [Installation](#installation)
- [Usage](#usage)
    - [Set the API Key](#set-the-api-key)
    - [Set the Production Mode](#set-the-production-mode)
- [Available Methods and Examples](#available-methods-and-examples)
    - [Locations](#locations)
        - [Get Countries](#get-countries)
        - [Get Provinces](#get-provinces)
        - [Get Cities](#get-cities)
        - [Get Origin Cities](#get-origin-cities)
        - [Get Suburbs](#get-suburbs)
        - [Get Areas](#get-areas)
        - [Search Location](#search-location)
    - [Rates](#rates)
        - [Get Domestic Rates](#get-domestic-rates)
        - [Get International Rates](#get-international-rates)
    - [Orders](#orders)
        - [Create Domestic Order](#create-domestic-order)
        - [Create International Order](#create-international-order)
        - [Get Tracking ID](#get-tracking-id)
        - [Activate Order](#activate-order)
        - [Get Order Detail](#get-order-detail)
        - [Update Order](#update-order)
        - [Cancel Order](#cancel-order)
    - [Pickup Orders](#pickup-orders)
        - [Create Pickup Request](#create-pickup-request)
        - [Cancel Pickup Request](#cancel-pickup-request)
        - [Get Agents by Suburb](#get-agents-by-suburb)
    - [Furthermore](#furthermore)
        - [Get All Tracking Status](#get-all-tracking-status)
        - [Generate AWB Number](#generate-awb-number)
- [Exceptions](#exceptions)
    - [ArgumentCountError](#argumentcounterror)
    - [InvalidArgumentException](#invalidargumentexception)
    - [ClientException](#clientexception)
- [Contributing](#contributing)

---

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

[](#installation)

Install shipper-php with composer by following command:

```
composer require yusufthedragon/shipper-php
```

or add it manually in your `composer.json` file.

Usage
-----

[](#usage)

### Set the API Key

[](#set-the-api-key)

Configure package with your account's api key obtained from Shipper.

```
Shipper::setApiKey('apiKey');
```

### Set the Production Mode

[](#set-the-production-mode)

When deploying your application to production, you may want to change API Endpoint as well by setting `setProductionMode` to `true`.

```
Shipper::setProductionMode(true);
// or chain it with setApiKey method
Shipper::setProductionMode(true)->setApiKey('apiKey');
```

Available Methods and Examples
------------------------------

[](#available-methods-and-examples)

### Locations

[](#locations)

#### Get Countries

[](#get-countries)

Retrieve country data in a list.

```
\Shipper\Location::getCountries();
```

Usage example:

```
$getCountries = \Shipper\Location::getCountries();
var_dump($getCountries);
```

#### Get Provinces

[](#get-provinces)

Retrieve all provinces in Indonesia in a list.

```
\Shipper\Location::getProvinces();
```

Usage example:

```
$getProvinces = \Shipper\Location::getProvinces();
var_dump($getProvinces);
```

#### Get Cities

[](#get-cities)

Retrieve cities based on submitted province ID.

```
\Shipper\Location::getCities(int $provinceId);
```

Usage example:

```
$getCities = \Shipper\Location::getCities(9);
var_dump($getCities);
```

#### Get Origin Cities

[](#get-origin-cities)

Retrieve provinces in which Shipper provides pickup service.

```
\Shipper\Location::getOriginCities();
```

Usage example:

```
$getOriginCities = \Shipper\Location::getOriginCities();
var_dump($getOriginCities);
```

#### Get Suburbs

[](#get-suburbs)

Retrieve suburbs based on submitted city ID.

```
\Shipper\Location::getSuburbs(int $cityId);
```

Usage example:

```
$getSuburbs = \Shipper\Location::getSuburbs(80);
var_dump($getSuburbs);
```

#### Get Areas

[](#get-areas)

Retrieve areas based on submitted suburb ID.

```
\Shipper\Location::getAreas(int $suburbId);
```

Usage example:

```
$getAreas = \Shipper\Location::getAreas(1330);
var_dump($getAreas);
```

#### Search Location

[](#search-location)

Retrieve every area, suburb, and city whose names include the submitted substring (including postcode).

```
\Shipper\Location::searchLocation(string $substring);
```

Usage example:

```
$searchLocation = \Shipper\Location::searchLocation('jakarta');
var_dump($searchLocation);
```

### Rates

[](#rates)

#### Get Domestic Rates

[](#get-domestic-rates)

```
\Shipper\Rates::getDomesticRates(array $parameters);
```

Usage example:

```
$parameters = [
    'o' => 4802,
    'd' => 4852,
    'l' => 20,
    'w' => 15,
    'h' => 10,
    'wt' => 1.0,
    'v' => 199000,
    'type' => 1,
    'cod' => 0,
    'order' => 0,
    'originCoord' => '-6.1575362903,106.7858796692',
    'destinationCoord' => '-6.17846396594961,106.84122923291011​'
];

$getDomesticRates = \Shipper\Rates::getDomesticRates($parameters);
var_dump($getDomesticRates);
```

#### Get International Rates

[](#get-international-rates)

```
\Shipper\Rates::getInternationalRates(array $parameters);
```

Usage example:

```
$parameters = [
    'o' => 4802,
    'd' => 180,
    'l' => 20,
    'w' => 15,
    'h' => 10,
    'wt' => 1.0,
    'v' => 199000,
    'type' => 2,
    'order' => 0
];

$getInternationalRates = \Shipper\Rates::getInternationalRates($parameters);
var_dump($getInternationalRates);
```

### Orders

[](#orders)

#### Create Domestic Order

[](#create-domestic-order)

```
\Shipper\Order::createDomesticOrder(array $parameters);
```

Usage example:

```
$parameters = [
    'o' => 4828,
    'd' => 4833,
    'l' => 10,
    'w' => 10,
    'h' => 10,
    'wt' => 1,
    'v' => 100000,
    'rateID' => 49,
    'consigneeName' => 'Peoorang',
    'consigneePhoneNumber' => '089899878987',
    'consignerName' => 'Peorang',
    'consignerPhoneNumber' => '089891891818',
    'originAddress' => 'Mangga Dua Selatan',
    'originDirection' => '',
    'destinationAddress' => 'Pasar Baru',
    'destinationDirection' => '',
    'itemName' => [
        [
            'name' => 'Baju',
            'qty' => 1,
            'value' => 100000
        ]
    ],
    'contents' => 'Merah',
    'useInsurance' => 0,
    'packageType' => 2,
    'paymentType' => 'cash',
    'externalID' => '',
    'cod' => 0
];

$createDomesticOrder = \Shipper\Order::createDomesticOrder($parameters);
var_dump($createDomesticOrder);
```

#### Create International Order

[](#create-international-order)

```
\Shipper\Order::createInternationalOrder(array $parameters);
```

Usage example:

```
$parameters = [
    'o' => 4802,
    'd' => 180,
    'l' => 10,
    'w' => 10,
    'h' => 10,
    'wt' => 1,
    'v' => 100000,
    'rateID' => 210,
    'consigneeName' => 'Peoorang',
    'consigneePhoneNumber' => '089899878987',
    'consignerName' => 'Peorang',
    'consignerPhoneNumber' => '089891891818',
    'originAddress' => 'Mangga Dua Selatan',
    'originDirection' => '',
    'destinationAddress' => 'Orchard Road 101',
    'destinationDirection' => '',
    'destinationArea' => 'Singapore',
    'destinationSuburb' => 'Singapore',
    'destinationCity' => 'Singapore',
    'destinationProvince' => 'Singapore',
    'destinationPostcode' => '111111',
    'itemName' => [
        [
            'name' => 'Baju',
            'qty' => 1,
            'value' => 100000
        ]
    ],
    'contents' => 'Merah',
    'useInsurance' => 0,
    'packageType' => 2,
    'paymentType' => 'cash',
    'externalID' => '',
    'cod' => 0
];

$createInternationalOrder = \Shipper\Order::createInternationalOrder($parameters);
var_dump($createInternationalOrder);
```

#### Get Tracking ID

[](#get-tracking-id)

Retrieve tracking ID of the order with the provided ID.

```
\Shipper\Order::getTrackingID(string $orderId);
```

Usage example:

```
$getTrackingID = \Shipper\Order::getTrackingID('5f259130a172cf001222f533');
var_dump($getTrackingID);
```

#### Activate Order

[](#activate-order)

Activate/Deactivate an order. Such activation will initiate Shipper's pickup process.

```
\Shipper\Order::activateOrder(string $orderId, array $parameters);
```

Usage example:

```
$parameters = [
    'active' => 1
];

$activateOrder = \Shipper\Order::activateOrder('5f259130a172cf001222f533', $parameters);
var_dump($activateOrder);
```

#### Get Order Detail

[](#get-order-detail)

Retrieve an order's detail. Date format is UTC time.

```
\Shipper\Order::getOrderDetail(string $orderId);
```

Usage example:

```
$getOrderDetail = \Shipper\Order::getOrderDetail('5f259130a172cf001222f533');
var_dump($getOrderDetail);
```

#### Update Order

[](#update-order)

Update an order's package's weight and dimension.

```
\Shipper\Order::updateOrder(string $orderId, array $parameters);
```

Usage example:

```
$parameters = [
    'l' => 1,
    'w' => 1,
    'h' => 1,
    'wt' => 1
];

$updateOrder = \Shipper\Order::updateOrder('5f259130a172cf001222f533', $parameters);
var_dump($updateOrder);
```

#### Cancel Order

[](#cancel-order)

Cancel an order.

```
\Shipper\Order::cancelOrder(string $orderId);
```

Usage example:

```
$cancelOrder = \Shipper\Order::cancelOrder('5f259130a172cf001222f533');
var_dump($cancelOrder);
```

### Pickup Orders

[](#pickup-orders)

#### Create Pickup Request

[](#create-pickup-request)

Assign agent and activate orders.

```
\Shipper\Pickup::createPickup(array $parameters);
```

Usage examples

```
$parameters = [
    'orderIds' => ['5e45538'],
    'agentId' => 1432,
    'datePickup' => '2020-08-11 10:30:00'
];

$createPickup = \Shipper\Pickup::createPickup($parameters);
var_dump($createPickup);
```

#### Cancel Pickup Request

[](#cancel-pickup-request)

Cancel pickup request.

```
\Shipper\Pickup::cancelPickup(array $parameters);
```

Usage example:

```
$parameters = [
    'orderIds' => ['5e45538'],
];

$cancelPickup = \Shipper\Pickup::cancelPickup($parameters);
var_dump($cancelPickup);
```

#### Get Agents by Suburb

[](#get-agents-by-suburb)

Get agent by origin suburb ID.

```
\Shipper\Pickup::getAgents(int $suburbId);
```

Usage example:

```
$getAgents = \Shipper\Pickup::getAgents(1330);
var_dump($getAgents);
```

### Furthermore

[](#furthermore)

#### Get All Tracking Status

[](#get-all-tracking-status)

```
\Shipper\Tracking::getAllStatus();
```

Usage example:

```
$getAllStatus = \Shipper\Tracking::getAllStatus();
var_dump($getAllStatus);
```

##### Generate AWB Number

[](#generate-awb-number)

Generate AWB from related logistic, in case that AWB number in order is not generated yet when order sent.

```
\Shipper\AWB::generate(array $parameters);
```

```
$parameters = [
    'oid' => '5f259130a172cf001222f533'
];

$generate = \Shipper\AWB::generate($parameters);
var_dump($generate);
```

Exceptions
----------

[](#exceptions)

### ArgumentCountError

[](#argumentcounterror)

`ArgumentCountError` will be thrown if too few arguments are passed to a function or method.

For example, argument `cityId` must be passed to function `getCities`. If user does not provide one, `ArgumentCountError` will be thrown.

### InvalidArgumentException

[](#invalidargumentexception)

`InvalidArgumentException` will be thrown if the argument provided by user is not sufficient to create the request, or if an argument is not of the excepted type.

For example, there are required arguments such as `l`, `w`, `h`, and `wt` to update an order. If user lacks one or more arguments when attempting to create one, or if one or more arguments are not `integer` nor `float`, `InvalidArgumentException` will be thrown.

### ClientException

[](#clientexception)

`ClientException` will be thrown if a client error is encountered (4xx codes) when send request to API.

For example, if order is not found when create a pickup request, `ClientException` will be thrown.

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

[](#contributing)

For any requests, bugs, or comments, please open an [issue](https://github.com/yusufthedragon/shipper-php/issues) or [submit a pull request](https://github.com/yusufthedragon/shipper-php/pulls).

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity51

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 ~703 days

Total

2

Last Release

1300d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/26558083?v=4)[Yusuf Ardi](/maintainers/yusufthedragon)[@yusufthedragon](https://github.com/yusufthedragon)

---

Top Contributors

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

---

Tags

Shipper

### Embed Badge

![Health badge](/badges/yusufthedragon-shipper-php/health.svg)

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

###  Alternatives

[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3731.2M42](/packages/tencentcloud-tencentcloud-sdk-php)[convertkit/convertkitapi

Kit PHP SDK for the Kit API

2167.1k1](/packages/convertkit-convertkitapi)[mapado/rest-client-sdk

Rest Client SDK for hydra API

1125.9k2](/packages/mapado-rest-client-sdk)

PHPackages © 2026

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