smart-dato / db-schenker
Laravel SDK for DB Schenker - Booking Parcel Customer API
Fund package maintenance!
Requires
- php: ^8.2|^8.5
- illuminate/contracts: ^10.0||^11.0||^12.0||^13.0
- saloonphp/saloon: ^4.0
- spatie/laravel-package-tools: ^1.16
Requires (Dev)
- larastan/larastan: ^2.9||^3.0
- laravel/pint: ^1.14
- nunomaduro/collision: ^8.1.1||^7.10.0
- orchestra/testbench: ^10.0.0||^9.0.0||^8.22.0
- pestphp/pest: ^3.0
- pestphp/pest-plugin-arch: ^3.0
- pestphp/pest-plugin-laravel: ^3.0
- phpstan/extension-installer: ^1.3||^2.0
- phpstan/phpstan-deprecation-rules: ^1.1||^2.0
- phpstan/phpstan-phpunit: ^1.3||^2.0
- rector/rector: ^2.0
- spatie/laravel-ray: ^1.35
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-09-23 14:34:35 UTC
README
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.