https://github.com/enuenan/pathao-courier
A complete Laravel package for Pathao Merchant Courier
https://github.com/enuenan/pathao-courier
api courier courier-api courier-api-integration laravel-package pathao pathao-api pathao-api-integration pathao-courier pathao-courier-laravel pathao-developer-api pathao-merchant pathao-merchant-api pathao-merchant-laravel-api
Last synced: 4 months ago
JSON representation
A complete Laravel package for Pathao Merchant Courier
- Host: GitHub
- URL: https://github.com/enuenan/pathao-courier
- Owner: enuenan
- License: mit
- Created: 2023-12-12T14:04:43.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2026-01-10T04:43:56.000Z (5 months ago)
- Last Synced: 2026-01-11T01:26:49.532Z (5 months ago)
- Topics: api, courier, courier-api, courier-api-integration, laravel-package, pathao, pathao-api, pathao-api-integration, pathao-courier, pathao-courier-laravel, pathao-developer-api, pathao-merchant, pathao-merchant-api, pathao-merchant-laravel-api
- Language: PHP
- Homepage:
- Size: 43 KB
- Stars: 15
- Watchers: 2
- Forks: 10
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
A complete Laravel Package for Pathao Courier
[](https://packagist.org/packages/enan/pathao-courier)
[](https://github.com/enan/pathao-courier/actions?query=workflow%3Arun-tests+branch%3Amain)
[](https://github.com/enan/pathao-courier/actions?query=workflow%3A"Fix+PHP+code+style+issues"+branch%3Amain)
[](https://packagist.org/packages/enan/pathao-courier)
A complete package for Laravel to use [Pathao Courier Merchant API](https://merchant.pathao.com/). Setup once and forget about it. You donβt even have to worry about the validation of creating orders, creating a store, or getting calculated price value which are generally a POST request on the Pathao courier end.
With this package you can get the following
- [x] Get the city list
- [x] Get the zone list
- [x] Get the area list
- [x] Get the store list
- [x] Create Store
- [x] Get order details
- [x] Get calculated price
- [x] Get the token exipiration days left and also expected date of it
- [x] Get the user success rate using phone number 
It offers you a bunch of validation for Create order, Create Store, Get calculated price.So you don't have to worry about the validation for all of this.
## βοΈ Installation
You can install the package via composer:
```bash
composer require enan/pathao-courier
```
You can publish the migration file and config file with:
```bash
php artisan vendor:publish --tag="pathao-courier-config"
```
Though Laravel auto discover. If not add the following in `config\app.php`. You can skip this part if you want.
```php
// add below line in the providers array
Enan\PathaoCourier\PathaoCourierServiceProvider::class,
// add below line in the alias array
'PathaoCourier' => Enan\PathaoCourier\Facades\PathaoCourier::class,
```
> Add the following environment variables to your `.env` file. You can choose the table name of migration before running the migration. Default is 'pathao-courier'
```bash
PATHAO_DB_TABLE_NAME='pathao-courier'
PATHAO_CLIENT_ID=
PATHAO_CLIENT_SECRET=
PATHAO_SECRET_TOKEN=
```
### π Where can I find the value?
Go to your [Pathao Developers Api](https://merchant.pathao.com/courier/developer-api) and you'll find `Merchant API Credentials` there.
And for `PATHAO_SECRET_TOKEN=` you'll be provided it after the successfull authentication.
### π« Setup
Run the migration
```bash
php artisan migrate
```
You have to set the token of pathao courier. To set run below artisan command
The command will ask the credentials. This is a one time process. You don't have to setup this again.
If you want to update current token and secret you can run the command again.
You will be provided a secret token here. Please set the token in your `.env` file with `PATHAO_SECRET_TOKEN=`
```bash
php artisan set:pathao-courier
```
## π Usage
Add the Facade before using
```php
use Enan\PathaoCourier\Facades\PathaoCourier;
```
> For the POST type response the required validation are mentioned before the function like So here the value should be required and string
```php
/**
* To Get the days left of token expiration
* You'll get the expected date of the expiration and total days left
*
* @type
*/
PathaoCourier::GET_ACCESS_TOKEN_EXPIRY_DAYS_LEFT();
/**
* To Get the cities
*
* @type
*/
PathaoCourier::GET_CITIES();
/**
* To Get the Zones
* @type
*
* @param int $city_id
*/
PathaoCourier::GET_ZONES(int $city_id);
/**
* To Get the Areas
* @type
*
* @param int $zone_id
*/
PathaoCourier::GET_AREAS(int $zone_id);
/**
* To Get the Stores
* @type
*
* @param int $page
* $page param is optional. If you want you can implement pagination here.
*/
PathaoCourier::GET_STORES(int $page);
/**
* To Create Store
* @type
* Pass below mentioned parameter
*
* @param $name
* @param $contact_name
* @param $contact_number
* @param $address
* @param $city_id
* @param $zone_id
* @param $area_id
*/
PathaoCourier::CREATE_STORE($request);
/**
* To Create Order
* @type
* Pass below mentioned parameter
*
* @param $store_id
* @param $merchant_order_id
* @param $sender_name
* @param $sender_phone
* @param $recipient_name
* @param $recipient_phone
* @param $recipient_address
* @param $recipient_city
* @param $recipient_zone
* @param $recipient_area
* @param $delivery_type is provided by the merchant and not changeable. 48 for Normal Delivery, 12 for On Demand Delivery"
* @param $item_type is provided by the merchant and not changeable. 1 for Document, 2 for Parcel"
* @param $special_instruction
* @param $item_quantity
* @param $item_weight
* @param $amount_to_collect
* @param $item_description
*/
PathaoCourier::CREATE_ORDER($request);
/**
* To Get Price Calculation
* @type
* Pass below mentioned parameter
*
* @param $delivery_type
* @param $item_type
* @param $item_weight
* @param $recipient_city
* @param $recipient_zone
* @param $store_id
*/
PathaoCourier::GET_PRICE_CALCULATION($request);
/**
* To View Order
* @type
* @param string $consignment_id
*/
PathaoCourier::VIEW_ORDER(string $consignment_id);
/**
* To Get User's success rate using phone number
* @type
* @param string $phone
*/
PathaoCourier::GET_USER_SUCCESS_RATE($request);
```
## Credits
- [Moammer Farshid Enan](https://github.com/Enan)
## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
## Check me on
- [Portfolio](https://moammer-enan.com/)
- [Facebook](https://www.facebook.com/moammerfarshidenan)
- [GitHub](https://github.com/enuenan)
- [LinkedIn](https://www.linkedin.com/in/moammer-farshid/)