flooris/dpd-shipper-laravel

Laravel 连接到 DPD Shipper API 的包

0.0.3 2023-06-13 14:34 UTC

This package is auto-updated.

Last update: 2024-09-13 17:20:26 UTC


README

Laravel 连接到 DPD Shipper API 的包。

要求

此包需要 Laravel 10.xPHP 8.1(或更高版本)。

Flooris

Flooris visual

我们是一个充满活力、目标明确的工程师团队。我们确保客户的在线挑战通过可管理且可持续的工具得到解决。我们将现有的可靠解决方案连接起来。这使我们能够创建定制解决方案,通常结合专业(开源)包和API。我们保证所有在线解决方案始终处于最高水平。此外,我们通过服务门户提供无忧的专业支持。

通过 composer 安装包

composer require flooris/dpd-shipper-laravel

发布包配置

php artisan vendor:publish --tag=dpd-shipper-config
nano config/dpd-shipper.php

使用示例

// Borsigstraße 20-22, 44145 Dortmund, Duitsland
// https://goo.gl/maps/FoKHQ4DwEEiY9ift5
$countryIso  = 'DE';
$postalCode  = '44145';
$parcelCount = 1;

$email       = 'test-dpd@flooris.nl';
$mobilePhone = '0612345678';

$shipmentProduct = new DpdShipmentProduct($countryIso, $postalCode);

$predict = $shipmentProduct->getPredict($countryIso, $email, $mobilePhone);

$parcels = new DpdParcels();
$parcels->setCustomerReferenceNumber1('TEST12345');
$parcels->setWeight(1);

$recipient = new DpdRecipient(
    name1: 'John Doe',
    street: 'Borsigstraße',
    houseNumber: '20-22',
    countryIso: 'DE',
    postalCode: $postalCode,
    city: 'Dortmund',
    email: $email
);

try {
    $shipmentLabel = $this->dpdShipperConnector->shipmentService()->createShipment(
        shipmentProduct: $shipmentProduct,
        parcelCount: $parcelCount,
        parcels: $parcels,
        sender: $this->dpdSender,
        recipient: $recipient,
        dpdPredict: $predict
    );
    
    $mpsId              = $shipmentLabel->mpsId;
    $barcodeCollection  = $shipmentLabel->getBarcodes();
    $pdfData            = $shipmentLabel->fileData;

} catch (DpdShipmentResponseException $e) {
} catch (\SoapFault $e) {
    throw $e;
}

更新日志

有关最近更改的更多信息,请参阅更新日志

贡献

有关详细信息,请参阅贡献指南

安全漏洞

有关报告安全漏洞的详细信息,请参阅我们的安全策略

鸣谢