pavolbiely/dhlmyapi

DHL myAPI

dev-master 2020-11-09 09:19 UTC

This package is auto-updated.

Last update: 2024-09-09 17:43:11 UTC


README

Build Status Coverage Status Donate

Please ask DHL for username, password and Customer ID in order to access their API.

Installation

Use composer to install this package.

Example of usage

Create a package and order a courier.

$dhl = new Dhl('user', 'pass', 1234, __DIR__ . '/temp');
$payment = new Payment('SK4123000000000002045678', 'POBNSKBA', '123456', 100.0);
$sender = NULL;
$recipient = new Address('TEST','TEST','TEST','TEST','SK');
$package = new Package(25183385203, Package::TYPE_SK_COD, Package::DEPO_HQ_BRATISLAVA, $recipient, $sender, $payment, [Package::FLAG_SAT], 'TEST');
$dhl->createPackages([$package]);
$dhl->createPickupOrders([new PickupOrder('TEST','TEST', 1, $recipient, 'info@example.org', NULL, NULL, NULL, 'TEST')])

Generating PDF labels

header('Content-Type: application/pdf');
echo PdfLabel::generateLabels($packages, PdfLabel::QUARTER);

How to run tests?

Tests are build with Nette Tester. You can run it like this:

php -f tester ./ -c php.ini-mac --coverage coverage.html --coverage-src ../src

Minimum requirements

  • PHP 7.1+

Credits

This code is based and inspired by salamek/ppl-my-api.

License

MIT License (c) Pavol Biely

Read the provided LICENSE file for details.