PHPackages                             cw-alihyder/postex-laravel - 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. cw-alihyder/postex-laravel

ActiveLibrary[API Development](/categories/api)

cw-alihyder/postex-laravel
==========================

Laravel 12 package for PostEx COD API integration

v1.0.3(4mo ago)054MITPHPPHP ^8.1

Since Dec 20Pushed 4mo agoCompare

[ Source](https://github.com/cw-alihyder/post-ex)[ Packagist](https://packagist.org/packages/cw-alihyder/postex-laravel)[ RSS](/packages/cw-alihyder-postex-laravel/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (2)Versions (5)Used By (0)

post-ex
=======

[](#post-ex)

**roadmap**.

---

📦 PostEx Laravel SDK
====================

[](#-postex-laravel-sdk)

**Laravel package for PostEx COD API integration**Supports order creation, delivery validation, tracking, payment status, pickup management, and more.

> Compatible with **Laravel 9, 10, 11**API Version: **PostEx v4.1.9**

---

🚀 Features
----------

[](#-features)

- ✅ Check if a **city/address is deliverable**
- 📦 Create COD orders
- 🚚 Track orders (single &amp; bulk)
- 🧾 Generate airway bill &amp; load sheet
- 🏬 Manage pickup addresses
- ❌ Cancel orders
- 💰 Check payment &amp; settlement status
- 📝 Shipper advice (retry / return)
- 📊 List orders &amp; statuses
- 🧩 Laravel Facade support
- 🔍 PSR-4, auto-discovery enabled

---

📌 Requirements
--------------

[](#-requirements)

RequirementVersionPHP≥ 8.0Laravel9.x / 10.x / 11.xPostEx API TokenRequired---

📥 Installation
--------------

[](#-installation)

Install via Composer:

```
composer require cw-alihyder/postex-laravel
```

---

⚙️ Configuration
----------------

[](#️-configuration)

Publish the config file:

```
php artisan vendor:publish --tag=postex-config
```

This will create:

```
config/postex.php
```

### 🔐 Environment Variables

[](#-environment-variables)

Add the following to your `.env`:

```
POSTEX_TOKEN=your_postex_api_token_here
POSTEX_BASE_URL=https://api.postex.pk/services/integration/api
```

---

🧠 Usage Overview
----------------

[](#-usage-overview)

You can use the package via:

- ✅ **Facade** (`PostEx::`)
- ✅ **Dependency Injection**

---

🏙 Check City Deliverability
---------------------------

[](#-check-city-deliverability)

```
use PostEx;

$isDeliverable = PostEx::isCityDeliverable('Lahore');

if (!$isDeliverable) {
    throw new Exception('Delivery not available in this city');
}
```

---

📦 Create Order (COD)
--------------------

[](#-create-order-cod)

```
use PostEx;

$response = PostEx::createOrder([
    'orderRefNumber'   => 'ORD-10001',
    'invoicePayment'   => 2500,
    'orderDetail'      => '1x Mobile Phone',
    'customerName'     => 'Ali Khan',
    'customerPhone'    => '03001234567',
    'deliveryAddress'  => 'Model Town, Lahore',
    'cityName'         => 'Lahore',
    'invoiceDivision'  => 1,
    'items'            => 1,
    'orderType'        => 'Normal', // Normal | Reverse | Replacement
]);

$trackingNumber = $response['dist']['trackingNumber'];
```

---

🚚 Track Order
-------------

[](#-track-order)

### Single Tracking

[](#single-tracking)

```
PostEx::track('CX-XXXXXXXXXXX');
```

### Bulk Tracking

[](#bulk-tracking)

```
PostEx::bulkTrack([
    'CX-XXXX1',
    'CX-XXXX2',
]);
```

---

💰 Payment Status
----------------

[](#-payment-status)

```
PostEx::paymentStatus('CX-XXXXXXXXXXX');
```

---

❌ Cancel Order
--------------

[](#-cancel-order)

```
PostEx::cancelOrder('CX-XXXXXXXXXXX');
```

---

🏬 Pickup Address Management
---------------------------

[](#-pickup-address-management)

### List Pickup Addresses

[](#list-pickup-addresses)

```
PostEx::listPickupAddresses('Lahore');
```

### Create Pickup Address

[](#create-pickup-address)

```
PostEx::createPickupAddress([
    'address' => 'Warehouse #12',
    'addressTypeId' => 2, // 1 Return, 2 Pickup
    'cityName' => 'Lahore',
    'contactPersonName' => 'Store Manager',
    'phone1' => '03001234567',
    'phone2' => '03007654321',
]);
```

---

🧾 Generate Load Sheet
---------------------

[](#-generate-load-sheet)

```
PostEx::generateLoadSheet([
    'CX-XXXX1',
    'CX-XXXX2'
], 'Main Warehouse');
```

---

📄 Generate Airway Bill (PDF)
----------------------------

[](#-generate-airway-bill-pdf)

```
PostEx::getAirwayBill([
    'CX-XXXX1',
    'CX-XXXX2'
]);
```

> ⚠️ Max 10 tracking numbers per request (PostEx limitation)

---

📝 Shipper Advice
----------------

[](#-shipper-advice)

### Save Advice

[](#save-advice)

```
PostEx::saveShipperAdvice(
    'CX-XXXXXXXXXXX',
    1, // 1 = Return Requested, 2 = Retry Attempt
    'Customer not available'
);
```

### Get Advice History

[](#get-advice-history)

```
PostEx::getShipperAdvice('CX-XXXXXXXXXXX');
```

---

📊 List Orders
-------------

[](#-list-orders)

```
PostEx::listOrders(
    0, // 0 = All statuses
    '2025-01-01',
    '2025-01-31'
);
```

---

🧪 Error Handling
----------------

[](#-error-handling)

All API responses follow PostEx standard format:

```
[
  'statusCode' => '200',
  'statusMessage' => 'SUCCESSFULLY OPERATED',
  'dist' => [...]
]
```

You should always check `statusCode` before trusting the response.

---

🧾 Versioning Policy (SemVer)
----------------------------

[](#-versioning-policy-semver)

This package follows **Semantic Versioning**:

```
MAJOR.MINOR.PATCH

```

### Examples:

[](#examples)

- `1.0.0` → Initial stable release
- `1.1.0` → New features (backward-compatible)
- `1.1.1` → Bug fixes
- `2.0.0` → Breaking changes

---

🗺 Roadmap
---------

[](#-roadmap)

- Automatic retries with backoff
- Laravel logging integration
- Queue-ready async support
- Unit &amp; feature tests
- Rate-limit handling
- Webhook handler (future)

---

🧑‍💻 Author
----------

[](#‍-author)

**Ali Hyder**📧

---

📜 License
---------

[](#-license)

MIT License © 2025 You are free to use, modify, and distribute.

---

⭐ Support
---------

[](#-support)

If this package helps you, please ⭐ star the repository on GitHub.

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance74

Regular maintenance activity

Popularity9

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity46

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

Total

4

Last Release

144d ago

### Community

Maintainers

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

---

Top Contributors

[![cw-alihyder](https://avatars.githubusercontent.com/u/91259045?v=4)](https://github.com/cw-alihyder "cw-alihyder (11 commits)")

### Embed Badge

![Health badge](/badges/cw-alihyder-postex-laravel/health.svg)

```
[![Health](https://phpackages.com/badges/cw-alihyder-postex-laravel/health.svg)](https://phpackages.com/packages/cw-alihyder-postex-laravel)
```

###  Alternatives

[resend/resend-laravel

Resend for Laravel

1191.4M6](/packages/resend-resend-laravel)[ryangjchandler/bearer

Minimalistic token-based authentication for Laravel API endpoints.

8129.8k](/packages/ryangjchandler-bearer)[stechstudio/laravel-hubspot

A Laravel SDK for the HubSpot CRM Api

2971.0k](/packages/stechstudio-laravel-hubspot)[simplestats-io/laravel-client

Client for SimpleStats!

4515.5k](/packages/simplestats-io-laravel-client)[spatie/spatie-price-api

The Price API used at promotional sites for our own products

1515.1k1](/packages/spatie-spatie-price-api)[dragon-code/laravel-json-response

Automatically always return a response in JSON format

1118.6k1](/packages/dragon-code-laravel-json-response)

PHPackages © 2026

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