1. Go to this page and download the library: Download smart-dato/dhl-parcel-sdk library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
smart-dato / dhl-parcel-sdk example snippets
use SmartDato\DhlParcel\Data\Orders\ContactAddressData;
use SmartDato\DhlParcel\Data\Orders\ShipmentData;
use SmartDato\DhlParcel\Data\Orders\ShipmentDetailsData;
use SmartDato\DhlParcel\Data\Orders\ShipmentOrderRequestData;
use SmartDato\DhlParcel\Data\Orders\ShipperData;
use SmartDato\DhlParcel\Data\Orders\WeightData;
use SmartDato\DhlParcel\Enums\DocFormat;
use SmartDato\DhlParcel\Enums\Product;
use SmartDato\DhlParcel\Enums\WeightUom;
use SmartDato\DhlParcel\Facades\DhlParcel;
$response = DhlParcel::orders()->create(
data: new ShipmentOrderRequestData(
profile: 'STANDARD_GRUPPENPROFIL',
shipments: [
new ShipmentData(
product: Product::V01PAK,
billingNumber: '33333333330102',
details: new ShipmentDetailsData(
weight: new WeightData(WeightUom::Grams, 500),
),
shipper: new ShipperData(
name1: 'My Online Shop GmbH',
addressStreet: 'Sträßchensweg 10',
city: 'Bonn',
country: 'DEU',
postalCode: '53113',
),
consignee: new ContactAddressData(
name1: 'Maria Musterfrau',
addressStreet: 'Kurt-Schumacher-Str. 20',
city: 'Bonn',
country: 'DEU',
postalCode: '53113',
),
),
],
),
docFormat: DocFormat::Pdf,
);
// Access the label
$label = $response->items[0]->label;