Skip to content

pavolbiely/dhlmyapi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DHL myAPI

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.