PHPackages                             dhl/sdk-api-bcs - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. dhl/sdk-api-bcs

ActiveLibrary[API Development](/categories/api)

dhl/sdk-api-bcs
===============

DHL business customer shipping API

2.2.1(8mo ago)7322.9k—2.3%15[3 PRs](https://github.com/netresearch/dhl-sdk-api-bcs/pulls)MITPHPPHP ^7.2.0 || ^8.0.0

Since Jan 16Pushed 8mo ago8 watchersCompare

[ Source](https://github.com/netresearch/dhl-sdk-api-bcs)[ Packagist](https://packagist.org/packages/dhl/sdk-api-bcs)[ RSS](/packages/dhl-sdk-api-bcs/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (9)Dependencies (17)Versions (13)Used By (0)

DHL BCS API SDK
===============

[](#dhl-bcs-api-sdk)

> **⚠️ DEPRECATION NOTICE**
>
> This SDK is **no longer supported** and will be **archived in the near future**.
>
> Please migrate to the new **DHL Parcel DE SDK** which only uses the modern REST API: ****

The DHL Business Customer Shipping API SDK package offers an interface to the following web services:

- [Geschäftskundenversand 3.1.2](https://entwickler.dhl.de/group/ep/wsapis/geschaeftskundenversand/current)
- [DHL Parcel DE Shipping 2.1.6](https://developer.dhl.com/api-reference/parcel-de-shipping-post-parcel-germany-v2)

Requirements
------------

[](#requirements)

### System Requirements

[](#system-requirements)

- PHP 7.2+ with SOAP and JSON extension

### Package Requirements

[](#package-requirements)

- `league/openapi-psr7-validator`: Schema validator for JSON request messages
- `netresearch/jsonmapper`: Mapper for deserialization of JSON response messages into PHP objects
- `php-http/discovery`: Discovery service for HTTP client and message factory implementations
- `php-http/httplug`: Pluggable HTTP client abstraction
- `php-http/logger-plugin`: HTTP client logger plugin for HTTPlug
- `psr/http-client`: PSR-18 HTTP client interfaces
- `psr/http-factory`: PSR-7 HTTP message factory interfaces
- `psr/http-message`: PSR-7 HTTP message interfaces
- `psr/log`: PSR-3 logger interfaces

### Virtual Package Requirements

[](#virtual-package-requirements)

- `psr/http-client-implementation`: Any package that provides a PSR-18 compatible HTTP client
- `psr/http-factory-implementation`: Any package that provides PSR-7 compatible HTTP message factories
- `psr/http-message-implementation`: Any package that provides PSR-7 HTTP messages

### Development Package Requirements

[](#development-package-requirements)

- `nyholm/psr7`: PSR-7 HTTP message factory &amp; message implementation
- `phpunit/phpunit`: Testing framework
- `php-http/mock-client`: HTTPlug mock client implementation
- `phpstan/phpstan`: Static analysis tool
- `squizlabs/php_codesniffer`: Static analysis tool

Installation
------------

[](#installation)

```
$ composer require dhl/sdk-api-bcs
```

Uninstallation
--------------

[](#uninstallation)

```
$ composer remove dhl/sdk-api-bcs
```

Testing
-------

[](#testing)

```
$ ./vendor/bin/phpunit -c test/phpunit.xml
```

Features
--------

[](#features)

The DHL BCS API SDK is able to connect to the legacy *Business Customer Shipping* SOAP API as well as its successor, the *Parcel DE Shipping* REST web service.

While the connection to the REST API includes some shipping services that were introduced after BCS v3.1.2, both connections share the same high-level functionality:

- Validate Shipment: Validate a shipment order without booking a label
- Create Shipment Order: Book a shipment label
- Delete Shipment Order: Cancel a shipment label

Please note that the *Parcel DE Shipping* REST API takes different arguments in some cases:

- sandbox credentials and EKP
- countries must be specified as three-letter codes

Authentication
--------------

[](#authentication)

Both APIs require a two-level authentication to identify application and user. The API SDK offers an authentication storage to pass credentials in.

```
// BCS
$authStorage = new \Dhl\Sdk\Paket\Bcs\Auth\AuthenticationStorage('appId', 'appToken', 'user', 'signature');

// Parcel DE Shipping
$authStorage = new \Dhl\Sdk\Paket\Bcs\Auth\AuthenticationStorage('', 'apiKey', 'user', 'password');
```

- API user credentials (user and signature/password) are created in the [DHL Business Customer Portal](https://geschaeftskunden.dhl.de/)
- SOAP access: application ID and token are created in the [Developer Portal](https://entwickler.dhl.de/)
- REST access: API key is created in the [API Developer Portal](https://developer.dhl.com/user/apps)

API Selection
-------------

[](#api-selection)

By default, the SDK connects to the legacy *Business Customer Shipping* SOAP API. In order to switch to the REST web service, pass an additional argument to the service factory:

```
$serviceFactory = new \Dhl\Sdk\Paket\Bcs\Service\ServiceFactory(
    \Dhl\Sdk\Paket\Bcs\Api\ServiceFactoryInterface::API_TYPE_REST
);
```

When using the request builder to create outgoing messages, then pass the respective argument there as well:

```
$requestBuilder = new \Dhl\Sdk\Paket\Bcs\RequestBuilder\ShipmentOrderRequestBuilder(
    \Dhl\Sdk\Paket\Bcs\Api\ShipmentOrderRequestBuilderInterface::REQUEST_TYPE_REST
);
```

More thorough examples on using service factory and request builder can be found in the section about [web service operations](#web-service-operations).

Web Service Operations
----------------------

[](#web-service-operations)

### Validate Shipment

[](#validate-shipment)

Validate shipments for DHL Paket including the relevant shipping documents.

#### Public API

[](#public-api)

The library's components suitable for consumption comprise

- services:
    - service factory
    - shipment service
    - data transfer object builder
- data transfer objects:
    - [authentication storage](#Authentication)
    - order/label settings
    - validation result with status message

#### Usage

[](#usage)

```
$logger = new \Psr\Log\NullLogger();

$serviceFactory = new \Dhl\Sdk\Paket\Bcs\Service\ServiceFactory();
$service = $serviceFactory->createShipmentService($authStorage, $logger, $sandbox = true);

$requestBuilder = new \Dhl\Sdk\Paket\Bcs\RequestBuilder\ShipmentOrderRequestBuilder();
$requestBuilder->setShipperAccount($billingNumber = '22222222220101');
$requestBuilder->setShipperAddress(
    $company = 'DHL',
    $country = 'DE',
    $postalCode = '53113',
    $city = 'Bonn',
    $street = 'Charles-de-Gaulle-Straße',
    $streetNumber = '20'
);
$requestBuilder->setRecipientAddress(
    $recipientName = 'Jane Doe',
    $recipientCountry = 'DE',
    $recipientPostalCode = '53113',
    $recipientCity = 'Bonn',
    $recipientStreet = 'Sträßchensweg',
    $recipientStreetNumber = '2'
);
$requestBuilder->setShipmentDetails($productCode = 'V01PAK', $shipmentDate = new \DateTime());
$requestBuilder->setPackageDetails($weightInKg = 2.4);

$shipmentOrder = $requestBuilder->create();
$result = $service->validateShipments([$shipmentOrder]);
```

### Create Shipment Order

[](#create-shipment-order)

Create shipments for DHL Paket including the relevant shipping documents. In addition to the primary shipment data (shipper, consignee, etc.), further settings can be defined per request via the *order configuration* object, including label printing size, profile, and more.

#### Public API

[](#public-api-1)

The library's components suitable for consumption comprise

- services:
    - service factory
    - shipment service
    - data transfer object builder
- data transfer objects:
    - [authentication storage](#Authentication)
    - order/label settings
    - shipment with shipment/tracking number and label(s)

#### Usage

[](#usage-1)

```
$logger = new \Psr\Log\NullLogger();

$serviceFactory = new \Dhl\Sdk\Paket\Bcs\Service\ServiceFactory();
$service = $serviceFactory->createShipmentService($authStorage, $logger, $sandbox = true);

$orderConfiguration = new \Dhl\Sdk\Paket\Bcs\Service\ShipmentService\OrderConfiguration(
    $printOnlyIfCodable = true,
    $combinedPrinting = null,
    $docFormat = \Dhl\Sdk\Paket\Bcs\Api\Data\OrderConfigurationInterface::DOC_FORMAT_PDF,
    $printFormat = \Dhl\Sdk\Paket\Bcs\Api\Data\OrderConfigurationInterface::PRINT_FORMAT_A4
);

$requestBuilder = new \Dhl\Sdk\Paket\Bcs\RequestBuilder\ShipmentOrderRequestBuilder();
$requestBuilder->setShipperAccount($billingNumber = '22222222220101');
$requestBuilder->setShipperAddress(
    $company = 'DHL',
    $country = 'DE',
    $postalCode = '53113',
    $city = 'Bonn',
    $street = 'Charles-de-Gaulle-Straße',
    $streetNumber = '20'
);
$requestBuilder->setRecipientAddress(
    $recipientName = 'Jane Doe',
    $recipientCountry = 'DE',
    $recipientPostalCode = '53113',
    $recipientCity = 'Bonn',
    $recipientStreet = 'Sträßchensweg',
    $recipientStreetNumber = '2'
);
$requestBuilder->setShipmentDetails($productCode = 'V01PAK', $shipmentDate = new \DateTime());
$requestBuilder->setPackageDetails($weightInKg = 2.4);

$shipmentOrder = $requestBuilder->create();
$shipments = $service->createShipments([$shipmentOrder], $orderConfiguration);
```

### Delete Shipment Order

[](#delete-shipment-order)

Cancel earlier created shipments.

#### Public API

[](#public-api-2)

The library's components suitable for consumption comprise

- services:
    - service factory
    - shipment service
- data transfer objects:
    - authentication storage

#### Usage

[](#usage-2)

```
$logger = new \Psr\Log\NullLogger();

$serviceFactory = new \Dhl\Sdk\Paket\Bcs\Service\ServiceFactory();
$service = $serviceFactory->createShipmentService($authStorage, $logger, $sandbox = true);

$shipmentNumber = '222201011234567890';
$cancelled = $service->cancelShipments([$shipmentNumber]);
```

###  Health Score

51

—

FairBetter than 96% of packages

Maintenance59

Moderate activity, may be stable

Popularity42

Moderate usage in the ecosystem

Community21

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

Top contributor holds 64.1% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~256 days

Recently: every ~305 days

Total

9

Last Release

258d ago

Major Versions

1.3.0 → 2.0.02023-06-30

PHP version history (3 changes)1.0.0PHP ^7.0.0

1.1.0PHP ^7.1.0

1.3.0PHP ^7.2.0 || ^8.0.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/efd68399f95aa07110668d9af1a47a8030d8df5ec5af4b28e821d442d787583a?d=identicon)[team-mage](/maintainers/team-mage)

---

Top Contributors

[![mam08ixo](https://avatars.githubusercontent.com/u/1771622?v=4)](https://github.com/mam08ixo "mam08ixo (50 commits)")[![Sebastian80](https://avatars.githubusercontent.com/u/6400300?v=4)](https://github.com/Sebastian80 "Sebastian80 (12 commits)")[![magicsunday](https://avatars.githubusercontent.com/u/564393?v=4)](https://github.com/magicsunday "magicsunday (6 commits)")[![AndreasMueller75](https://avatars.githubusercontent.com/u/32193606?v=4)](https://github.com/AndreasMueller75 "AndreasMueller75 (6 commits)")[![powli](https://avatars.githubusercontent.com/u/4511053?v=4)](https://github.com/powli "powli (2 commits)")[![CybotTM](https://avatars.githubusercontent.com/u/326348?v=4)](https://github.com/CybotTM "CybotTM (1 commits)")[![YiffyToys](https://avatars.githubusercontent.com/u/52350973?v=4)](https://github.com/YiffyToys "YiffyToys (1 commits)")

---

Tags

phpsdk

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/dhl-sdk-api-bcs/health.svg)

```
[![Health](https://phpackages.com/badges/dhl-sdk-api-bcs/health.svg)](https://phpackages.com/packages/dhl-sdk-api-bcs)
```

###  Alternatives

[phpro/http-tools

HTTP tools for developing more consistent HTTP implementations.

28137.8k](/packages/phpro-http-tools)[openai-php/client

OpenAI PHP is a supercharged PHP API client that allows you to interact with the Open AI API

5.8k22.6M232](/packages/openai-php-client)[opensearch-project/opensearch-php

PHP Client for OpenSearch

15224.3M65](/packages/opensearch-project-opensearch-php)[getbrevo/brevo-php

Official Brevo provided RESTFul API V3 php library

963.1M35](/packages/getbrevo-brevo-php)[mozex/anthropic-php

Anthropic PHP is a supercharged community-maintained PHP API client that allows you to interact with Anthropic API.

46365.1k13](/packages/mozex-anthropic-php)[swisnl/json-api-client

A PHP package for mapping remote JSON:API resources to Eloquent like models and collections.

211473.2k12](/packages/swisnl-json-api-client)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
