misterbrownrsa/laravel-dhl-api
Composer 安装命令:
composer require misterbrownrsa/laravel-dhl-api
包简介
DHL API wrapper for LARAVEL
README 文档
README
I needed a laravel-esque wrapper to make calls to the DHL XML service, but couldn't find any. So I created one. It was specifically designed for my own personal use, but you are welcome to submit issues, and I'll look into refactoring it so that it can be used in a more general purpose fashion.
Getting Started
Prerequisites
This was built and tested ONLY on Laravel 5.5, although I'm sure it'll work on previous versions as well.
Installing
composer require misterbrownrsa/laravel-dhl-api
Since Laravel 5.5 automatically includes the service provider, it won't be necessary to register it. However, if you really want to, run the following command
##Usage Examples
###Capability
This is typically used to test the validity of addresses and DHL's capability to deliver. Validate must return true.
$user = User::first();
$GetCapability = new \MisterBrownRSA\DHL\API\GetCapability();
$GetCapability->user($user);
dd($GetCapability->validate());
Dump the request
dump($GetCapability->toXML());
Dump the response
dump($GetCapability->doCurlPost());
dump($GetCapability->requestRAW());
###Quotation
This is used to get product information such as the price and total transit days.
$product = [];
foreach ($cart->items as $key => $cartItem) {
for ($i = 1; $i <= $cartItem->quantity; $i++) {
$product[ $key ]['height'] = $box['height'];
$product[ $key ]['depth'] = $box['length'];
$product[ $key ]['width'] = $box['width'];
$product[ $key ]['weight'] = $cartItem->warehouse->product->weight + $box1['weight'];
}
}
$GetQuote = new \MisterBrownRSA\DHL\API\GetQuote();
$GetQuote->user($user)
->reference($cart->order->reference)
->addProduct($product)
->declaredValue($cart->subtotal);
$result = $GetQuote
->doCurlPost();
dd($result);
Dump the request
dd($GetQuote->toXML());
Dump the response
dump($GetQuote->results());
dump($GetQuote->resultsRAW());
Authors
- Duwayne Brown - Initial work - MisterBrownRSA
License
This project is licensed under the MIT License - see the LICENSE.md file for details
Acknowledgments
- Thanks David for your help during the implementation process
misterbrownrsa/laravel-dhl-api 适用场景与选型建议
misterbrownrsa/laravel-dhl-api 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 5.44k 次下载、GitHub Stars 达 3, 最近一次更新时间为 2017 年 12 月 03 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 misterbrownrsa/laravel-dhl-api 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 misterbrownrsa/laravel-dhl-api 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 5.44k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 5
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-12-03