PHPackages                             devrkb21/pathao-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. devrkb21/pathao-laravel

ActiveLibrary[API Development](/categories/api)

devrkb21/pathao-laravel
=======================

A complete Laravel package for Pathao Courier API integration with built-in validation, webhook handling, location caching, and Artisan commands.

00PHP

Since Jun 10Pushed todayCompare

[ Source](https://github.com/devrkb21/pathao-laravel)[ Packagist](https://packagist.org/packages/devrkb21/pathao-laravel)[ RSS](/packages/devrkb21-pathao-laravel/feed)WikiDiscussions pub Synced today

READMEChangelog (2)DependenciesVersions (2)Used By (0)

Pathao Laravel — Complete Laravel Package for Pathao Courier API
================================================================

[](#pathao-laravel--complete-laravel-package-for-pathao-courier-api)

 [![Latest Version on Packagist](https://camo.githubusercontent.com/f838ff0403dad57ab728006ba2a0758c61ac2e7b7cf28469fc3d3582c6956007/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f646576726b6232312f70617468616f2d6c61726176656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/devrkb21/pathao-laravel) [![Total Downloads](https://camo.githubusercontent.com/2e79d08bcd8907ce03af7f22a3aaad8d2093f5679a75626424f7cd16e321571d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f646576726b6232312f70617468616f2d6c61726176656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/devrkb21/pathao-laravel) [![License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](https://github.com/devrkb21/pathao-laravel/blob/main/LICENSE.md)

A complete Laravel package for [Pathao Courier Merchant API](https://merchant.pathao.com/) integration. Setup once and forget about it — built-in validation, webhook handling, location caching, API logging, and powerful Artisan commands.

✨ Features
----------

[](#-features)

- ✅ Client Credentials authentication with automatic token refresh
- ✅ Sandbox &amp; Production environment support
- ✅ Cities, Zones, Areas — with bulk endpoints &amp; local database caching
- ✅ Store management (List &amp; Create)
- ✅ Order management (Create, View, Bulk Create, Price Calculation)
- ✅ Merchant profile info retrieval
- ✅ User success rate by phone number
- ✅ Webhook signature validation with Laravel event dispatching
- ✅ API request &amp; webhook logging to database
- ✅ Built-in request validation for all POST endpoints
- ✅ Artisan commands for setup, sync, status, and diagnostics

---

⚙️ Installation
---------------

[](#️-installation)

```
composer require devrkb21/pathao-laravel
```

Publish the config file:

```
php artisan vendor:publish --tag="pathao-config"
```

> Laravel auto-discovers the service provider. If needed, manually register:

```
// config/app.php — providers array
devrkb21\PathaoLaravel\PathaoLaravelServiceProvider::class,

// config/app.php — aliases array
'PathaoLaravel' => devrkb21\PathaoLaravel\Facades\PathaoLaravel::class,
```

### Environment Variables

[](#environment-variables)

Add the following to your `.env` file:

```
PATHAO_CLIENT_ID=
PATHAO_CLIENT_SECRET=
PATHAO_SECRET_TOKEN=
PATHAO_WEBHOOK_INTEGRATION_SECRET=
PATHAO_SANDBOX=false
PATHAO_DB_TABLE_NAME=pathao-courier
```

> **Where to find credentials?** Go to [Pathao Developers API](https://merchant.pathao.com/courier/developer-api) → Merchant API Credentials.

### Setup

[](#setup)

Run the migration:

```
php artisan migrate
```

Set up authentication (one-time process):

```
php artisan pathao:setup
```

You will be provided a `secret_token`. Set it in your `.env` as `PATHAO_SECRET_TOKEN`.

---

🏗 Usage
-------

[](#-usage)

```
use devrkb21\PathaoLaravel\Facades\PathaoLaravel;
```

### Location APIs

[](#location-apis)

```
// Get all cities
PathaoLaravel::GET_CITIES();

// Get zones for a city
PathaoLaravel::GET_ZONES(int $city_id);

// Get areas for a zone
PathaoLaravel::GET_AREAS(int $zone_id);

// Bulk fetch all zones / areas
PathaoLaravel::GET_ZONES_BULK();
PathaoLaravel::GET_AREAS_BULK();
```

### Store APIs

[](#store-apis)

```
// List stores (with optional pagination)
PathaoLaravel::GET_STORES(int $page = 1);

// Create a new store
// Required: name, contact_name, contact_number, address, city_id, zone_id, area_id
PathaoLaravel::CREATE_STORE($request);
```

### Order APIs

[](#order-apis)

```
// Create an order
// Required: store_id, recipient_name, recipient_phone, recipient_address,
//           delivery_type (48=Normal, 12=On-Demand), item_type (1=Document, 2=Parcel),
//           item_quantity, item_weight, amount_to_collect
PathaoLaravel::CREATE_ORDER($request);

// Create multiple orders in bulk
PathaoLaravel::CREATE_ORDERS_BULK(array $orders);

// View order details
PathaoLaravel::VIEW_ORDER(string $consignment_id);

// Calculate delivery price
PathaoLaravel::GET_PRICE_CALCULATION($request);
```

### Merchant &amp; User APIs

[](#merchant--user-apis)

```
// Get merchant profile info
PathaoLaravel::GET_MERCHANT_INFO();

// Get user success rate by phone
PathaoLaravel::GET_USER_SUCCESS_RATE($request);

// Check token expiry
PathaoLaravel::GET_ACCESS_TOKEN_EXPIRY_DAYS_LEFT();
```

---

🔧 Artisan Commands
------------------

[](#-artisan-commands)

CommandDescription`pathao:setup`Set up authentication credentials and generate secret token`pathao:merchant-info`Verify API connection and display merchant profile info`pathao:sync-locations`Fetch and cache all cities, zones, and areas into local database`pathao:status`Display connection config, token status, and cached location counts`pathao:clear-cache`Clear cached location tables---

🔔 Webhook Integration
---------------------

[](#-webhook-integration)

The package automatically registers a webhook endpoint at:

```
POST /api/pathao/webhook

```

**Webhook Verification**: To verify your webhook URL on Pathao's merchant dashboard, the package automatically captures the required challenge token UUID and echoes it back in the `X-Pathao-Merchant-Webhook-Integration-Secret` header. If necessary, you can manually set this UUID in your `.env` file as `PATHAO_WEBHOOK_INTEGRATION_SECRET`.

**Signature Validation**: Incoming requests are validated against `X-Pathao-Signature` header using your `PATHAO_SECRET_TOKEN`.

**Event Dispatching**: On valid webhook, the package dispatches a `PathaoWebhookReceived` event. Listen for it in your application:

```
use devrkb21\PathaoLaravel\Events\PathaoWebhookReceived;

Event::listen(PathaoWebhookReceived::class, function ($event) {
    $payload = $event->payload;

    // Map webhook data to your order status updates
    // $payload['event'], $payload['consignment_id'], $payload['order_status'], etc.
});
```

**Logging**: All webhook calls (valid and invalid) are logged to the `pathao_webhook_logs` table. All API requests are logged to `pathao_api_logs`.

---

📦 Database Tables
-----------------

[](#-database-tables)

After running migrations, the following tables are created:

TablePurpose`pathao-courier` (configurable)Stores access tokens and secret keys`pathao_cities`Cached cities directory`pathao_zones`Cached zones directory`pathao_areas`Cached areas directory`pathao_api_logs`API request/response history`pathao_webhook_logs`Webhook callback history---

Credits
-------

[](#credits)

- [Rakib Uddin](https://github.com/devrkb21)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance65

Regular maintenance activity

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity13

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/215704528?v=4)[Rakib Uddin](/maintainers/devrkb21)[@devrkb21](https://github.com/devrkb21)

---

Top Contributors

[![devrkb21](https://avatars.githubusercontent.com/u/215704528?v=4)](https://github.com/devrkb21 "devrkb21 (3 commits)")

### Embed Badge

![Health badge](/badges/devrkb21-pathao-laravel/health.svg)

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

###  Alternatives

[facebook/php-business-sdk

PHP SDK for Facebook Business

90923.5M35](/packages/facebook-php-business-sdk)[exsyst/swagger

A php library to manipulate Swagger specifications

35916.3M7](/packages/exsyst-swagger)[hubspot/api-client

Hubspot API client

24015.5M18](/packages/hubspot-api-client)[botman/driver-telegram

Telegram driver for BotMan

93452.6k6](/packages/botman-driver-telegram)

PHPackages © 2026

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