bernhardk/laravel-dpd 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

bernhardk/laravel-dpd

最新稳定版本:v1.8.2

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

Latest Stable Version GitHub issues GitHub license Packagist Twitter

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

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.

统计信息

  • 总下载量: 3.39k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 13
  • 点击次数: 7
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 13
  • Watchers: 1
  • Forks: 12
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-12-05