承接 rafalli/dpd-info-services-bundle 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

rafalli/dpd-info-services-bundle

Composer 安装命令:

composer require rafalli/dpd-info-services-bundle

包简介

Symfony 7.4 Bundle integrating DPD InfoServices SOAP API for tracking packages

README 文档

README

Build Status Latest Stable Version Total Downloads License PHP Version Require

Installation

Install the package via Composer:

composer require rafalli/dpd-info-services-bundle

Configuration

  1. Create a configuration file rafalli_dpd_info_services.yaml in your Symfony project:
rafalli_dpd_info_services:
    wsdl_url: '%env(DPD_WSDL_URL)%'
    channel: '%env(int:DPD_CHANNEL)%'
    username: '%env(DPD_USERNAME)%'
    password: '%env(DPD_PASSWORD)%'
  1. Add your DPD credentials to your .env file:
DPD_WSDL_URL="https://dpdinfoservices.dpd.com.pl/DPDInfoServicesObjEventsService/DPDInfoServicesObjEvents?wsdl"
DPD_CHANNEL=12345
DPD_USERNAME=your_login
DPD_PASSWORD=your_password    

Usage

Basic Interaction

Inject the DpdInfoServiceClientInterface and use the following pattern to handle tracking updates:

use Rafalli\DpdInfoServicesBundle\Dto\Request\RetrievalContextDto;
use Rafalli\DpdInfoServicesBundle\Dto\Response\DpdEventDto;
use Rafalli\DpdInfoServicesBundle\Exception\DpdApiException;
use Rafalli\DpdInfoServicesBundle\Service\DpdInfoServiceClientInterface;

// Inject the interface via constructor
public function __construct(
    private readonly DpdInfoServiceClientInterface $dpdClient
) {}

// Fetch and process events
try {
    $response = $this->dpdClient->fetchNewEvents(new RetrievalContextDto(limit: 100));

    foreach ($response->events as $event) {
        // $event is an instance of DpdEventDto
        // Access data: $event->waybill, $event->eventCode, $event->newWaybill
    }

    // Confirm processing (Required by DPD API to clear the queue)
    if ($response->requiresConfirmation()) {
        $this->dpdClient->markAsProcessed($response->confirmId);
    }
} catch (DpdApiException $e) {
    // Handle connection or API errors
}

Checking a Single Waybill

To check the history of a specific parcel without affecting the global event queue:

$history = $this->dpdClient->getWaybillHistory('0000000000000U');

Delivery Tracking Utility

If you only need to know whether a parcel was successfully delivered (and exactly when), you can use the built-in WaybillDeliveryTrackerInterface which provides clean and easy-to-use domain logic.

use Rafalli\DpdInfoServicesBundle\Service\WaybillDeliveryTrackerInterface;

public function __construct(
    private readonly WaybillDeliveryTrackerInterface $deliveryTracker
) {}

public function checkStatus(string $waybill): void
{
    // Returns true if the parcel is marked as delivered (including COD deliveries)
    if ($this->deliveryTracker->isDelivered($waybill)) {

    } 
}

public function checkDeliveryDate(string $waybill): void
{
    // Returns the DateTimeImmutable object of the exact delivery moment
    $date = $this->deliveryTracker->getDeliveryDate($waybill);
}

Translations

The bundle provides an EventCode Enum that integrates with Symfony's Translation component. You can render translated descriptions directly in Twig:

{# Translation Domain: rafalli_dpd_info_services #}
{{ eventDto.eventCode.translationKey | trans({}, 'rafalli_dpd_info_services') }}

Error Handling

All SOAP-related errors or validation issues throw a Rafalli\DpdInfoServicesBundle\Exception\DpdApiException. This exception encapsulates the original SoapFault, making it easy to debug while keeping your application domain clean.

License

MIT License

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-05-16

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固