bernhardk/laravel-dpd
Composer 安装命令:
composer require bernhardk/laravel-dpd
包简介
Laravel package for using DPD Webservices to submit shipment to dpd und retrieve its label and tracking information.
README 文档
README
This is a laravel package for the DPD Webservices based on Michiel Meertens' "DPD Webservice" (https://github.com/meertensm/DPD).
Installation
You can install the package via composer with the following command into an existing laravel project. Please note the requirements below.
$ composer require bernhardk/laravel-dpd
After that you need to publish the config-file with the following command:
$ php artisan vendor:publish --provider="BernhardK\Dpd\DpdServiceProvider" --tag="config"
As soon you have configured the credentials in /config/dpd.php you are ready to use the package as described below.
Features
- Submit a shipment to the dpd webservice and retrieve it's label and tracking information
- Retrieve parcel status information
Requirements
- PHP SOAP extension needs to be installed (https://stackoverflow.com/questions/2509143/how-do-i-install-soap-extension/41518256)
- Edit configuration parameters in /config/dpd.php. All parameters are described.
DPD Webservice versions
| Webservice | Version |
|---|---|
| Login Service | 2.0 |
| Shipment Service | 4.4 |
| Parcel Life Cycle Service | 2.0 |
Basic shipment usage
The package registers a class that can be directly used:
app()->dpdShipment
The following code describes a sample usage and returns a PDF file.
// Enable DPD B2C delivery method app()->dpdShipment->setPredict([ 'channel' => 'email', 'value' => 'someone@mail.com', 'language' => 'EN' ]); // ATTENTION: Cause of privacy reasons transmitting clients email address is only allowed if client agreed. // Set the general shipmentdata app()->dpdShipment->setGeneralShipmentData([ 'product' => 'CL', 'mpsCustomerReferenceNumber1' => 'Test shipment' ]); // Set the sender's address app()->dpdShipment->setSender([ 'name1' => 'Your Company', 'street' => 'Street 12', 'country' => 'NL', 'zipCode' => '1234AB', 'city' => 'Amsterdam', 'email' => 'contact@yourcompany.com', 'phone' => '1234567645' ]); // Set the receiver's address app()->dpdShipment->setReceiver([ 'name1' => 'Joh Doe', 'name2' => null, 'street' => 'Street', 'houseNo' => '12', 'zipCode' => '1234AB', 'city' => 'Amsterdam', 'country' => 'NL', 'contact' => null, 'phone' => null, 'email' => null, 'comment' => null ]); // Add as many parcels as you want app()->dpdShipment->addParcel([ 'weight' => 3000, // In gram 'height' => 10, // In centimeters 'width' => 10, 'length' => 10 ]); app()->dpdShipment->addParcel([ 'weight' => 5000, 'height' => 0, // In centimeters 'width' => 0, 'length' => 0 // All parameters need to be given. Enter 0 if you have no value ]); // Submit the shipment app()->dpdShipment->submit(); // Get the trackingdata $trackinglinks = app()->dpdShipment->getParcelResponses(); // Show the pdf label header('Content-Type: application/pdf'); echo app()->dpdShipment->getLabels();
Basic tracking usage
The package registers a class that can be directly used:
app()->dpdTracking
The following code describes a sample usage and returns the Tracking-Status.
// Retrieve the parcel's status by it's awb number $parcelStatus = app()->dpdTracking->getStatus('09981122330100');
Support
If you have any questions or problems please open a new issue.
License
This package is licensed under the MIT license. The package is based on Michiel Meertens' "DPD Webservice" (https://github.com/meertensm/DPD), which is also licensed under the MIT license.
bernhardk/laravel-dpd 适用场景与选型建议
bernhardk/laravel-dpd 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3.44k 次下载、GitHub Stars 达 14, 最近一次更新时间为 2018 年 12 月 05 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「webservices」 「laravel」 「dpd」 「dpd cloud service」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 bernhardk/laravel-dpd 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 bernhardk/laravel-dpd 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 bernhardk/laravel-dpd 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
DPD Magento2 Shipping extension
Kinikit - PHP Application development framework
A collection of server-side addons that might be of use for development of xml-rpc (and json-rpc) based applications
Kinikit - PHP Application development framework MVC component
NuSOAP PHP library
DPD Connect - Magento2 Shipping GraphQL
统计信息
- 总下载量: 3.44k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 14
- 点击次数: 21
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-12-05