ecommerce-utilities / dhl-api
DHL-API
0.1.3
2024-04-11 15:40 UTC
Requires
- php: >= 8.1
- ext-curl: *
- ext-dom: *
- ext-json: *
- psr/http-client: ^1.0
- psr/http-factory: ^1.0
- psr/http-message: ^1.1 || ^2.0
Requires (Dev)
- dhl/sdk-api-bcs-returns: ^2.0
- guzzlehttp/guzzle: 7.*
- guzzlehttp/psr7: ^2.4
- http-interop/http-factory-guzzle: ^1.0
- php-http/curl-client: ^2.2
- php-http/message: ^1.13
- phpstan/phpstan: ^1.10
- rector/rector: ^1.0
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!
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());