Search by

smart-dato / db-schenker

smart-dato

Laravel SDK for DB Schenker - Booking Parcel Customer API

Package info

github.com/smart-dato/db-schenker

pkg:composer/smart-dato/db-schenker

Fund package maintenance!

SmartDato

Statistics

Installs: 5 570

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

0.1.0 2026-09-23 07:26 UTC

README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

A Laravel package for the DB Schenker Booking Parcel Customer API, built on Saloon. It saves and submits parcel bookings.

Requirements

  • PHP 8.2+
  • Laravel 10 – 13

Installation

composer require smart-dato/db-schenker

Publish the config file:

php artisan vendor:publish --tag="db-schenker-config"

Configuration

DB_SCHENKER_BASE_URL=https://wwwtest.dbschenker.com/nges-portal
DB_SCHENKER_TOKEN=your-api-token

The test environment is https://wwwtest.dbschenker.com/nges-portal; production is https://www.dbschenker.com/nges-portal.

Usage

DbSchenker reads the base URL and token from config, or you can pass them explicitly. The DbSchenker facade resolves the same class with the configured values.

use SmartDato\DbSchenker\DbSchenker;

$dbSchenker = new DbSchenker();

// or: new DbSchenker(url: 'https://…', token: '…');

Build a shipment

use SmartDato\DbSchenker\Data\AddressData;
use SmartDato\DbSchenker\Data\PackageData;
use SmartDato\DbSchenker\Data\ShipmentData;
use SmartDato\DbSchenker\Data\ShipmentOptionData;
use SmartDato\DbSchenker\Data\ShippingPartyData;

$shipment = new ShipmentData(
    productCode: 'your-product-code',
    incoterm: 'DAP',
    shipper: new ShippingPartyData(new AddressData(
        name: 'Sender GmbH',
        phone: '+49 30 000000',
        street: 'Musterstraße',
        streetNumber: '1',
        city: 'Berlin',
        countryCode: 'DE',
        personType: 'your-person-type',
        postalCode: '10115',
    )),
    consignee: new ShippingPartyData(new AddressData(
        name: 'Jane Doe',
        phone: '+43 1 000000',
        street: 'Hauptstraße',
        streetNumber: '5',
        city: 'Wien',
        countryCode: 'AT',
        personType: 'your-person-type',
        postalCode: '1010',
    )),
    packages: [
        new PackageData(
            codAmount: 0,
            description: 'Books',
            packagingCode: 'your-packaging-code',
            weight: 2.5,
            weightUnit: 'your-weight-unit',
            length: 30,
            width: 20,
            height: 10,
            dimensionUnit: 'your-dimension-unit',
            quantity: 1,
        ),
    ],
    files: [], // FileData instances for accompanying documents
    shipmentOptions: [new ShipmentOptionData(name: 'your-option')],
    labelFormat: 'your-label-format',
);

shipmentOptions, labelFormat and the optional address fields are omitted from the request body when left empty.

Codes such as personType, weightUnit, dimensionUnit, packagingCode and labelFormat are sent to DB Schenker unchanged — the SDK defines no enums for them, so use the values from your DB Schenker integration documentation.

Save and submit a booking

// Save the booking without submitting it — POST /api/booking/parcel/save
$response = $dbSchenker->save($shipment);

// Submit the booking — POST /api/booking/parcel/submit
$response = $dbSchenker->submit($shipment);

$response->json();

Both return a Saloon Response, so the usual status(), json() and throw() are available. The underlying DbSchenkerConnector is available as $dbSchenker->connector if you want to send SaveRequest / SubmitRequest yourself.

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.