raj5852 / pathao-courier
孟加拉国 Pathao 快递服务 API 包
dev-main
2024-02-01 20:36 UTC
Requires
- php: ^7.2|^7.3|^8.0|^8.1
- guzzlehttp/guzzle: ^7.0.1
- illuminate/support: ~6|~7|~8|~9
This package is not auto-updated.
Last update: 2024-09-27 22:11:35 UTC
README
PathaoCourier孟加拉国
这是一个用于 Pathao BD 快递系统的 Laravel/PHP 包。此包可用于 laravel 或没有 laravel/php 项目的项目。您可以使用此包进行无头/rest 实现以及 blade 或常规模式开发。我们在为一个项目工作时创建了此包,并认为将其发布出来,以便于所有人使用,这样可以帮助到大家。此包作为常规的 php composer 包 提供使用。
特性
需求
- PHP >=7.4
- Laravel >= 6
安装
composer require codeboxr/pathao-courier
vendor publish (配置)
php artisan vendor:publish --provider="Codeboxr\PathaoCourier\PathaoCourierServiceProvider"
发布配置文件后,设置您的凭证。您可以在配置目录下的 pathao.php 文件中看到这些
"sandbox" => env("PATHAO_SANDBOX", false), // for sandbox mode use true
"client_id" => env("PATHAO_CLIENT_ID", ""),
"client_secret" => env("PATHAO_CLIENT_SECRET", ""),
"username" => env("PATHAO_USERNAME", ""),
"password" => env("PATHAO_PASSWORD", "")
设置 .env 配置
PATHAO_SANDBOX=true // for production mode use false
PATHAO_CLIENT_ID=""
PATHAO_CLIENT_SECRET=""
PATHAO_USERNAME=""
PATHAO_PASSWORD=""
使用方法
1. 获取 Pathao 交付城市列表
use Codeboxr\PathaoCourier\Facade\PathaoCourier
return PathaoCourier::area()->city();
2. 获取 Pathao 区域列表
use Codeboxr\PathaoCourier\Facade\PathaoCourier
return PathaoCourier::area()->zone($cityId); // City ID
3. 获取 Pathao 交付区域列表
use Codeboxr\PathaoCourier\Facade\PathaoCourier
return PathaoCourier::area()->area($zoneId); // Zone ID
4. 创建新的存储点
use Codeboxr\PathaoCourier\Facade\PathaoCourier
return PathaoCourier::store()
->create([
"name" => "", // Store Name
"contact_name" => "", // Store contact person name
"contact_number" => "", // Contact person number
"address" => "", // Store address
"secondary_contact" => "", // Contact person secondary number not mandatory
"city_id" => "", // Find in city method
"zone_id" => "", // Find in zone method
"area_id" => "", // Find in Area method
]);
5. 获取存储点列表
use Codeboxr\PathaoCourier\Facade\PathaoCourier
return PathaoCourier::store()->list();
6. 创建新的包裹
use Codeboxr\PathaoCourier\Facade\PathaoCourier
return PathaoCourier::order()
->create([
"store_id" => "", // Find in store list,
"merchant_order_id" => "", // Unique order id
"recipient_name" => "", // Customer name
"recipient_phone" => "", // Customer phone
"recipient_address" => "", // Customer address
"recipient_city" => "", // Find in city method
"recipient_zone" => "", // Find in zone method
"recipient_area" => "", // Find in Area method
"delivery_type" => "", // 48 for normal delivery or 12 for on demand delivery
"item_type" => "", // 1 for document,
2 for parcel
"special_instruction" => "",
"item_quantity" => "", // item quantity
"item_weight" => "", // parcel weight
"amount_to_collect" => "", // amount to collect
"item_description" => "" // product details
]);
7. 获取订单详情
use Codeboxr\PathaoCourier\Facade\PathaoCourier
return PathaoCourier::order()->orderDetails($consignmentId); // After successfully create order they given a consignment_id
贡献
欢迎对 Pathao 包的贡献。在提交您的 pull request 之前,请注意以下指南。
- 遵循 PSR-4 编码标准。
- 首先阅读 Pathao API 文档
许可证
Pathao 包采用 MIT 许可证。
版权所有 2022 Codeboxr