0.1.3 2024-04-11 15:40 UTC

This package is auto-updated.

Last update: 2024-11-13 10:29:34 UTC


README

Use at your own risk - parents are responsible for their children!

Latest Stable Version License

Composer

composer require ecommerce-utilities/dhl-api *

Example:

<?php
use EcommerceUtilities\DHL\Common\DHLApiCredentials;
use EcommerceUtilities\DHL\Common\DHLBusinessPortalCredentials;
use EcommerceUtilities\DHL\DHLServices;
use GuzzleHttp\Client;
use Http\Factory\Guzzle\RequestFactory;
use Http\Message\StreamFactory\GuzzleStreamFactory;

require 'vendor/autoload.php';

$businessCred = new DHLBusinessPortalCredentials('<appId from entwickler.dhl.de>', '<Token from entwickler.dhl.de>');
$cred = new DHLApiCredentials(true, '<username of www.dhl.de/de/geschaeftskunden>', '<password of www.dhl.de/de/geschaeftskunden>', '<receiver-id>');

$services = new DHLServices($businessCred, $cred, new RequestFactory(), new GuzzleStreamFactory(), new Client());
$response = $services->getRetoureService()->getRetourePdf(
	'Max',         // $name1
	'Mustermann',  // $name2
	null,          // $name3
	'Musterstr.',  // $street
	123,           // $streetNumber
	72770,         // $zip
	'Reutlingen',  // $city
	'DE',          // $countryId
	'123446-B',    // $voucherNr
	null           // $shipmentReference
);

printf("%s\n", $response->getTrackingNumber());
file_put_contents('label.pdf', $response->getLabelData());