Download the PHP package nayemuf/pathao-courier without Composer
On this page you can find all versions of the php package nayemuf/pathao-courier. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download nayemuf/pathao-courier
More information about nayemuf/pathao-courier
Files in nayemuf/pathao-courier
Package pathao-courier
Short Description Laravel package for Pathao Courier Merchant API integration with caching and rate limiting
License MIT
Informations about the package pathao-courier
Laravel Pathao Courier Package
A professional Laravel package for integrating with Pathao Courier Merchant API. This package provides a clean, well-structured interface for all Pathao API endpoints with built-in caching, rate limiting, and comprehensive error handling.
✨ Features
- ✅ Complete API Coverage - All 11 Pathao Merchant API endpoints implemented
- ✅ OAuth 2.0 Authentication - Automatic token management with intelligent caching
- ✅ Rate Limiting - Built-in protection against API abuse (configurable)
- ✅ Input Validation - Comprehensive validation before API calls
- ✅ Error Handling - Detailed exception messages with field-level errors
- ✅ Laravel Best Practices - Service Provider, Facades, and publishable config
- ✅ Sandbox & Production - Full support for both environments
- ✅ Type Safety - Complete type hints and PHPDoc documentation
- ✅ Zero Configuration - Works out of the box with sensible defaults
📋 Requirements
- PHP >= 8.2
- Laravel >= 10.0
- Guzzle HTTP Client >= 7.0
📦 Installation
Install the package via Composer:
The package will automatically register its service provider and facade.
⚙️ Configuration
Step 1: Publish Configuration
Publish the configuration file to your config directory:
This will create config/pathao.php in your Laravel application.
Step 2: Environment Variables
Add the following to your .env file:
🧪 Sandbox Credentials (for Testing)
Pathao provides sandbox credentials for testing:
📍 Test Store IDs (Sandbox)
You can use any of these store IDs for testing in the sandbox environment:
| Store ID | Store Name |
|---|---|
149049 |
double discount |
149048 |
Test Marchent |
149047 |
Test Seller |
149046 |
mo |
149045 |
DCC Online |
149044 |
Becho |
149043 |
Sandbox Store |
149042 |
Elvis Lowe |
149040 |
Partha |
149039 |
Partha Store |
Note: To get the full list of available stores, use:
🚀 Usage
Create an Order
Create Bulk Orders
Get Order Information
Get Cities, Zones, and Areas
Calculate Delivery Price
Store Management
Refresh Access Token
📚 API Reference
Authentication
PathaoCourier::refreshToken(string $refreshToken)- Refresh access token using refresh token
Order API
PathaoCourier::order()->create(array $orderData)- Create a new orderPathaoCourier::order()->createBulk(array $orders)- Create multiple orders at oncePathaoCourier::order()->getInfo(string $consignmentId)- Get order short infoPathaoCourier::order()->getDetails(string $consignmentId)- Get full order details
Area API
PathaoCourier::area()->getCities()- Get list of all citiesPathaoCourier::area()->getZones(int $cityId)- Get zones for a specific cityPathaoCourier::area()->getAreas(int $zoneId)- Get areas for a specific zone
Store API
PathaoCourier::store()->create(array $storeData)- Create a new storePathaoCourier::store()->list()- Get list of all storesPathaoCourier::store()->getInfo(int $storeId)- Get merchant store info
Price API
PathaoCourier::price()->calculate(array $priceData)- Calculate delivery price
⚠️ Error Handling
The package throws Nayemuf\PathaoCourier\Exceptions\PathaoException for all API errors:
🔒 Caching
Access tokens are automatically cached using Laravel's cache system to reduce API calls. Tokens are cached for their full lifetime (5 days) minus 5 minutes for safety. The cache key is configurable in config/pathao.php.
🚦 Rate Limiting
The package includes built-in rate limiting to prevent API abuse. By default, it limits requests to 60 per minute. You can configure this in your config/pathao.php:
✅ Validation Rules
All input data is validated before sending to the API:
- Recipient name: 3-100 characters
- Recipient phone: Exactly 11 characters (must start with 01)
- Recipient address: 10-220 characters
- Item weight: 0.5-10 kg
- Delivery type: 48 (Normal) or 12 (On Demand)
- Item type: 1 (Document) or 2 (Parcel)
- Item quantity: Minimum 1
🧪 Testing
Run the test suite:
Or run PHPUnit directly:
🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Guidelines
Before contributing, please ensure you follow these guidelines:
- Follow PSR-4 Autoloading Standard - All code must adhere to PSR-4 autoloading standards
- Refer to Pathao Official Documentation First - Always check the Pathao API Documentation before implementing new features or changes
- Maintain Code Quality - Follow existing code style, add proper type hints, and include PHPDoc comments
- Write Tests - Include tests for new features or bug fixes
- Update Documentation - Update README, CHANGELOG, and inline documentation as needed
Contribution Process
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Make your changes following the guidelines above
- Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request with a clear description of your changes
📝 Changelog
Please see CHANGELOG for more information on what has changed recently.
🔗 Links
📄 License
The MIT License (MIT). Please see License File for more information.
👤 Author
Nayem Uddin
- Email: [email protected]
- GitHub: @nayemuf
- LinkedIn: @nayemuf
🙏 Acknowledgments
- Pathao for providing the Merchant API
- Laravel community for the amazing framework
🐛 Reporting Issues
For issues, questions, or feature requests, please open an issue on GitHub.
💝 Support
If this package helps you, please consider giving it a ⭐ on Packagist or GitHub.
All versions of pathao-courier with dependencies
illuminate/support Version ^10.0|^11.0|^12.0
illuminate/cache Version ^10.0|^11.0|^12.0
guzzlehttp/guzzle Version ^7.0