PHPackages                             aymakan/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. aymakan/php-sdk

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

aymakan/php-sdk
===============

Aymakan PHP SDK

21.9k↑50%PHP

Since Mar 13Pushed 4y ago3 watchersCompare

[ Source](https://github.com/aymakan/php-sdk)[ Packagist](https://packagist.org/packages/aymakan/php-sdk)[ RSS](/packages/aymakan-php-sdk/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Aymakan PHP SDK
===============

[](#aymakan-php-sdk)

This is official Aymakan PHP SDK. It can be used to integrate with Aymakan APIs. The following features lists are available in this SDK.For more details about our API requests and responses [click here](https://developer.aymakan.com.sa/docs/2).

- ### [General Methods](#general-methods-1)

    [](#general-methods)

    - [Ping API](#ping-api-method)
    - [Aymakan Cities](#cities-method)
- ### [Shipping Methods](#shipping-methods-1)

    [](#shipping-methods)

    - [Create shipping](#create-shipping)
    - [Create bulk shipping](#create-bulk-shipping)
    - [Create reverse pickup Shipping](#create-a-reverse-pickup-shipping)
    - [Track shipping](#track-shipping)
    - [Track shipping by reference](#track-shipping-using-reference)
    - [Cancel Shipping](#cancel-shipping)
    - [Cancel shipping by reference](#cancel-shipping-using-reference)
    - [Shipping AWB label](#shipping-awb-label-printing)
    - [Bulk shipping AWB labels](#bulk-shipping-awb-label-printing)
    - [Customer shipping](#customer-shipping)
- ### [Pickup Requests Methods](#pickup-requests-methods)

    [](#pickup-requests-methods)

    - [Get pickup requests](#get-pickup-requests)
    - [Create pickup request](#create-pickup-request)
    - [Cancel pickup request](#cancel-pickup-request)
    - [Time slots](#time-slots)
- ### [Customer Addresses Methods](#customer-addresses-methods)

    [](#customer-addresses-methods)

    - [Get Address](#get-address)
    - [Add Address](#create-address)
    - [Update address](#update-address)
    - [Delete address](#delete-address)
- ### [WebHooks Methods](#web-hooks-methods)

    [](#webhooks-methods)

    - [Get Web hooks](#get-webhooks)
    - [Add Web Hook](#add-webhook)
    - [Update Web Hook](#update-webhook)
    - [Delete webhook](#delete-webhook)

---

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

[](#requirements)

- PHP 7.1 or higher
- Curl 7.18 or higher

Installing using Composer
-------------------------

[](#installing-using-composer)

```
composer require aymakan/php-sdk

```

Getting Started
---------------

[](#getting-started)

Your Aymakan access token are available in your customer dashboard account

Setting configuration while instantiating the Client object

Used for composer based installation

```
// 1. Autoload the SDK Package. This will include all the files and classes to your autoloader'
// Used for composer based installation

require __DIR__  . '/vendor/autoload.php';

// Instantiate the client class
$client = new \Aymakan\Client();
// set token
$client->setApikey('ENTER-YOUR-API-KEY-HERE');
// set Sandbox testing mode
$client->setSandbox(true);
```

---

General Methods
---------------

[](#general-methods-1)

### Ping API Method

[](#ping-api-method)

Below is an example on how to fetch api status through ping API call:

```
$response = $client->pingApi();
echo $response . "\n";
```

[Ping API Details](https://developer.aymakan.com.sa/docs/2/ping)

([back to top](#top))

### Cities Method

[](#cities-method)

Below is an example on how to fetch all cities through GetCities API call:

```
$response = $client->getCityList();
echo $response . "\n";
```

[Cities API Details](https://developer.aymakan.com.sa/docs/2/cities)

([back to top](#top))

---

Shipping Methods
----------------

[](#shipping-methods-1)

### Create Shipping

[](#create-shipping)

Creates a new shipment , to find out more details about `request parameters` checkout our
[Create Shipping API Documentation](https://developer.aymakan.com.sa/docs/2/create-shipping)

```
$data = array(
 //request parameters
);

$response = $client->createShipment($data);
echo $response . "\n";
```

([back to top](#top))

### Create Bulk Shipping

[](#create-bulk-shipping)

Below is an example on how to create bulk shipments:

#### Mandatory Parameter

[](#mandatory-parameter)

ParameterTypeMandatory`shipments`Array of shipmentsYes```
$data = array(
    "shipments" =>
    array(
        # data for shipment 1
    ),
    array(
        # data for shipment 2
    ),
      ...
      ...
)

$response = $client->createBulkShipment($data);
echo $response . "\n";
```

[Create Bulk Shippings API Documentation](https://developer.aymakan.com.sa/docs/2/create-bulk-shippings)

([back to top](#top))

### Create a Reverse Pickup Shipping

[](#create-a-reverse-pickup-shipping)

Creates a reverse pickup shipment , to find out more details about `request parameters` checkout our
[Create Reverse Pickup Shipping API Documentation](https://developer.aymakan.com.sa/docs/2/create-reverse-pickup-shipping)

```
$data = array(
 //request parameters
);

$response = $client->createReversePickupShipment($data);
echo $response . "\n";
```

([back to top](#top))

### Track Shipping

[](#track-shipping)

Below is an example on how to track shipments through TrackShipment API call. Shipments can be fetched as a single shipment or multiple shipments at the same time . It is important to note that the tracking numbers should be sent in an array format.

#### Mandatory Parameter

[](#mandatory-parameter-1)

ParameterTypeMandatoryTracking NumberArrayYes```
//Track single shipment
$response = $client->trackShipment(['AY120266']);

//Track multiple shipments
$response = $client->trackShipment(['AY669001659', '143862', '143866']);

echo $response . "\n";
```

[Track Shipping API Details](https://developer.aymakan.com.sa/docs/2/track-shipping)

([back to top](#top))

### Track Shipping Using Reference

[](#track-shipping-using-reference)

Below is an example on how to track shipments by reference number. Shipments can be fetched by reference number as a single shipment or multiple shipments at the same time . It is important to note that the reference number numbers should be sent in an array format.

#### Mandatory Parameter

[](#mandatory-parameter-2)

ParameterTypeMandatoryReference NumberArrayYes```
//Track single shipment by reference number
$response = $client->shipmentByReference(['200018179']);

//Track Multiple shipment by reference number
$response = $client->shipmentByReference(['200018179','test-200018179']);

echo $response . "\n";
```

[Shipment By Reference API Details](https://developer.aymakan.com.sa/docs/2/shipments-by-reference)

([back to top](#top))

### Cancel Shipping

[](#cancel-shipping)

Below is an example of how to Cancel Shipment :

#### Mandatory Parameters

[](#mandatory-parameters)

Parametervariable nameTypeMandatoryTracking Number`tracking`ArrayYes```
$response = $client->cancelShipment(['tracking' => "AY120266"]);
echo $response . "\n";
```

[Cancel Shipment API Details](https://developer.aymakan.com.sa/docs/2/cancel-shipping)

([back to top](#top))

### Cancel Shipping Using Reference

[](#cancel-shipping-using-reference)

Below is an example on how to cancel shipments by reference number. Shipments can be fetched by reference number as a single shipment or multiple shipments at the same time . It is important to note that the reference number numbers should be sent in an array format.

#### Mandatory Parameter

[](#mandatory-parameter-3)

ParameterTypeMandatoryReference NumberArrayYes```
# Track single shipment by reference number
$response = $client->cancelShipmentByReference(['200018179'])

# Track Multiple shipment by reference number
$response = $client->cancelShipmentByReference(['200018179','test-200018179'])

echo $response . "\n";
```

[Cancel shipment By Reference API Details](https://developer.aymakan.com.sa/docs/2/cancel-shipping-by-reference)

([back to top](#top))

### Shipping AWB label Printing

[](#shipping-awb-label-printing)

Below is an example on how to make the Shipping AWB label Printing API call. This API requires a single tracking number associated with the customer account , and returns a URL to download the pdf file for all AWB

#### Mandatory Parameters

[](#mandatory-parameters-1)

Parametervariable nameTypeMandatoryTracking Code`tracking_number`StringYes```
$response = $client->getShipmentLabel("AY120266");
echo $response . "\n";
```

[Shipping AWB label Printing API Details](https://developer.aymakan.com.sa/docs/2/shipping-awb-label)

([back to top](#top))

### Bulk Shipping AWB label Printing

[](#bulk-shipping-awb-label-printing)

Below is an example on how get Bulk Shipping AWB label . This API requires an array with tracking numbers associated with the customer account. If all the tracking numbers are found for that associated account, this API returns a URL to download the pdf file for all AWB.

#### Mandatory Parameters

[](#mandatory-parameters-2)

ParameterTypeMandatoryTracking NumberArrayYes```
//Get multiple shipment label
$client->getBulkShipmentLabel(['AY669001659', '143862', '143866', '143892']);
echo $response . "\n";
```

[Bulk Shipping AWB label Printing API Details](https://developer.aymakan.com.sa/docs/2/bulk-awb-labels)

([back to top](#top))

### Customer Shipping

[](#customer-shipping)

Below is an example on how to make the Customer Shippings API call:

```
$response = $client->getCustomerShipments();
echo $response . "\n";
```

[Customer Shipping API Details](https://developer.aymakan.com.sa/docs/2/customer-shipping)

([back to top](#top))

---

Pickup Requests Methods
-----------------------

[](#pickup-requests-methods-1)

### Get Pickup Requests

[](#get-pickup-requests)

This API fetches all current customer pickup requests.

```
$response = $client->pickupRequest()
echo $response . "\n";
```

[Get Pickup Requests API Details](https://developer.aymakan.com.sa/docs/2/pickup-requests)

([back to top](#top))

### Create pickup request

[](#create-pickup-request)

Below is an example on how to create a pickup request.

Parametervariable nameTypeMandatoryDate format should be "Y-m-d"`pickup_date`StringYesTime slot`time_slot`StringYesThe customer's name`contact_name`StringYesThe customer's phone`contact_phone`StringYesThe customer's address`address`StringYesAmount of shipments`shipments`IntegerYes```
$data = array(
    "pickup_date" => "2022-12-02",
    "time_slot" => "afternoon",
    "contact_name" => "example",
    "contact_phone" => "059999999",
    "address" => "example address",
    "shipments" => 2
);

$response = $client->createPickupRequest($data)
echo $response . "\n";
```

[Create Pickup Request API Details](https://developer.aymakan.com.sa/docs/2/create-pickup-request)

([back to top](#top))

### Cancel pickup request

[](#cancel-pickup-request)

Below is an example on how to cancel a pickup request.

Parametervariable nameTypeMandatoryPickup request id`pickup_request_id`IntegerYes```
$data = array(
    "pickup_request_id" => 4021
}

$response = $client->cancelPickupRequest($data)
echo $response . "\n";
```

[Cancel Pickup Request API Details](https://developer.aymakan.com.sa/docs/2/cancel-pickup-request)

([back to top](#top))

### Time slots

[](#time-slots)

Below is an example on how to fetch all time slots available to current customer.

Parametervariable nameTypeMandatoryDate format should be "Y-m-d"`pickup_date`StringYes```
$response = $client->timeSlots("2022-12-02")
echo $response . "\n";
```

[Time Slots API Details](https://developer.aymakan.com.sa/docs/2/time-slots)

([back to top](#top))

---

Customer Addresses Methods
--------------------------

[](#customer-addresses-methods-1)

Manages address associated to customer account.

### Get Address

[](#get-address)

Fetches ALL addresses associated to customer account.

```
$response = $client->getAddress();

echo $response . "\n";
```

[Get Address API Details](https://developer.aymakan.com.sa/docs/2/customer-address-get)

([back to top](#top))

### Create Address

[](#create-address)

Below is an example on how to make the create address associated to customer account.

#### Mandatory Parameters

[](#mandatory-parameters-3)

Parametervariable nameMandatoryTitle`title`YesName`name`YesEmail`email`YesAddress`address`YesNeighbourhood`neighbourhood`YesPostcode`postcode`YesPhone`phone`YesDescription`description`Yes```
$data = array(
    "title" => "Mr",
    "name" => "example",
    "email" => "example@example.com",
    "city" => "Riyadh",
    "address" => 123,
    "neighbourhood" => "Al-Sahafah",
    "postcode" => "11534",
    "phone" => 0599999999,
    "description" => "create address example"
);

$response = $client->createAddress($data);
echo $response . "\n";
```

[Create Address API Details](https://developer.aymakan.com.sa/docs/2/customer-address-add)

([back to top](#top))

### Update Address

[](#update-address)

Below is an example on how to update address associated to customer account.

#### Mandatory Parameters

[](#mandatory-parameters-4)

Parametervariable nameMandatoryID`id`YesTitle`title`YesName`name`YesEmail`email`YesAddress`address`YesNeighbourhood`neighbourhood`YesPostcode`postcode`YesPhone`phone`YesDescription`description`Yes```
$data = array(
    "id" => 3,
    "title" => "Mr",
    "name" => "example",
    "email" => "example@example.com",
    "city" => "Riyadh",
    "address" => 123,
    "neighbourhood" => "Al-Sahafah",
    "postcode" => "11534",
    "phone" => 0599999999,
    "description" => "update address example"
);

$response = $client->updateAddress($data);
echo $response . "\n";
```

[Update Address API Details](https://developer.aymakan.com.sa/docs/2/customer-address-update)

([back to top](#top))

### Delete Address

[](#delete-address)

Below is an example on how to delete an address associated to customer account.

#### Mandatory Parameters

[](#mandatory-parameters-5)

Parametervariable nameMandatoryID`id`Yes```
$data = array(
    "id" => 544,
);

$response = $client->deleteAddress($data);
var_dump($response);
```

[Delete Address API Details](https://developer.aymakan.com.sa/docs/2/customer-address-delete)

([back to top](#top))

---

Web Hooks Methods
-----------------

[](#web-hooks-methods)

Web Hooks are a convenient way to receive real time updates for your shipments as soon as a status is updated. Web Hooks can be used to update customer internal systems with the latest shipments statuses.

### Get Webhooks

[](#get-webhooks)

Below is an example on how to get webhooks .

```
$response = $client->getWebHook();
echo $response . "\n";
```

[Get Webhooks API Details](https://developer.aymakan.com.sa/docs/2/web-hooks-get)

([back to top](#top))

### Add Webhook

[](#add-webhook)

Below is an example on how to add webhook .

#### Mandatory Parameters

[](#mandatory-parameters-6)

Parametervariable nameMandatoryWeb Hook URL`webhook_url`Yes```
$data = array(
    "webhook_url" => "https://testings.com"
);

$response = $client->createWebHook($data);
echo $response . "\n";
```

[Add Webhook API Details](https://developer.aymakan.com.sa/docs/2/web-hooks-add)

([back to top](#top))

### Update Webhook

[](#update-webhook)

Below is an example on how to update Webhook .

#### Mandatory Parameters

[](#mandatory-parameters-7)

Parametervariable nameMandatoryID`id`YesWeb Hook URL`webhook_url`Yes```
$data = array(
    "id"=> 219 ,
    "webhook_url" => "https://www.testings.com"
);

$response = $client->updateWebHook($data);
echo $response . "\n";
```

[Update Webhook API Details](https://developer.aymakan.com.sa/docs/2/web-hooks-update)

([back to top](#top))

### Delete Webhook

[](#delete-webhook)

Below is an example on how to delete webhooks .

```
$response = $client->deleteWebHook()
echo $response . "\n";
```

[Delete Webhooks API Details](https://developer.aymakan.com.sa/docs/2/web-hooks-delete)

([back to top](#top))

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity26

Early-stage or recently created project

 Bus Factor1

Top contributor holds 76% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/7eac134b6f9a938e65bc70448bf19971d1cf82ed9b6345316a29da82cbde21c8?d=identicon)[aymakan](/maintainers/aymakan)

---

Top Contributors

[![devusmancode](https://avatars.githubusercontent.com/u/81288832?v=4)](https://github.com/devusmancode "devusmancode (19 commits)")[![altafhussain10](https://avatars.githubusercontent.com/u/4163772?v=4)](https://github.com/altafhussain10 "altafhussain10 (4 commits)")[![Abdullah-AyMakan](https://avatars.githubusercontent.com/u/97884981?v=4)](https://github.com/Abdullah-AyMakan "Abdullah-AyMakan (2 commits)")

### Embed Badge

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

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

###  Alternatives

[nystudio107/eagerbeaver

Allows you to eager load elements from auto-injected Entry elements on demand from your templates.

251.5k](/packages/nystudio107-eagerbeaver)

PHPackages © 2026

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