korbeil / dhl-express-php-api
An up to date PHP client for DHL Express API
Installs: 58 408
Dependents: 0
Suggesters: 0
Security: 0
Stars: 6
Watchers: 1
Forks: 0
Open Issues: 1
Requires
- php: ^8.0
- jane-php/open-api-runtime: ^7.0
- nyholm/psr7: ^1.5
- php-http/discovery: ^1.13
- symfony/http-client: ^5.4 || ^6.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.14
- jane-php/open-api-3: ^7.0
- phpunit/phpunit: ^9.0
Conflicts
- php-http/httplug: < 2.0
README
I found close to nothing related to DHL Express API and needed it for a customer. So here I decided to make it open-source so everybody could use it freely.
This SDK is generated automatically with JanePHP from the official DHL Express specs.
It also provides a full object oriented interface for all the endpoints, requests and responses of the DHL Express REST API.
Installation
This library is made with symfony/http-client
as our HTTP
transport. So by installing it, you'll have close to nothing in order to make it work:
composer require korbeil/dhl-express-php-api
Quick start
// $client contains all the methods to interact with the API $clientFactory = new Korbeil\DHLExpress\ClientFactory($dhlExpressUrl, $dhlExpressUsername, $dhlExpressPassword); $client = $clientFactory->getClient(); $pickupRequest = new Korbeil\DHLExpress\Api\Model\SupermodelIoLogisticsExpressPickupRequest(); // ... fill your request contents $response = $client->expApiPickups($pickupRequest); $trackingNumbers = $response->getDispatchConfirmationNumbers();
Tests
If you want to use the DHL Express API in your tests, you can get a client dedicated for this purpose by doing as following:
$testClient = $clientFactory->getMockClient();
License
This library is licensed under the MIT License - see the LICENSE file for details.