Download the PHP package christoph-schaeffer/dhl-business-shipping without Composer
On this page you can find all versions of the php package christoph-schaeffer/dhl-business-shipping. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download christoph-schaeffer/dhl-business-shipping
More information about christoph-schaeffer/dhl-business-shipping
Files in christoph-schaeffer/dhl-business-shipping
Package dhl-business-shipping
Short Description DHL business customer shipping
License MIT
Informations about the package dhl-business-shipping
DHL business shipping
An unofficial library for the DHL business shipping soap API (Version 3.3) written in PHP.
Features
This library provides access to functions provided by the official dhl business shipping soap api in an object oriented way.
Since version 3.2 this library also includes the DHL shipment tracking api to obtain tracking data of sent shipments.
These functions are:
- Create, delete and update shipment labels
- Generate export documents
- Check if shipment data is valid
- Download reports of a given date as a pdf file
Additional functions this library provides:
- Mapping the returned status messages to objects instead of just returning strings
- Seperation of street name and street/house number. However this is experimental.
- Country code to country name conversion
- PHPunit testing of internal functions
- A detailed documentation page
Since version 3.2 this library also includes the DHL shipment tracking api to obtain tracking data of sent shipments.
This introduced the following new features:
- Obtain tracking data of sent shipments
- Download signature images of signed shipments
Getting started
Technical Requirements
- PHP 5.6=<
- PHP soap extension
- Composer
Authentication Requirements
- DHL developer account
- To get an API key login to your DHL developer account and register your application here. For production mode you will also have to request approval of your application by DHL.
- DHL business customer account, which is essentially the live account a user will login and order shipment labels with.
- For Tracking: ZT-Token and Password of that token. You can get those on the DHL business customer portal under My Data->Tracking
Installation
Add this repository to your composer.json requirements manually or navigate to your repository and enter the following command:
Usage
There are 3 client classes in this library ShippingClient, TrackingClient and MultiClient. The MultiClient combines both Clients into one, which usually is what you want. Thus we use it as the base example. The authentication credentials are stored in 2 classes. One for the business shipping api and one for the tracking api. These 2 APIs are not the same and need different parameter for authentication.
Create a shipping client credentials object and fill it with your credentials.
Create a tracking client credentials object and fill it with your credentials.
Create a client object and fill it with your credentials.
Usage for the shipping api (shipment label creation)
The following is a simple example usage of the createShipmentOrder function. However please keep in mind that there is a lot of additional functionality. For more details or examples of other functions please read the documentation.
Create a new shipment order for each shipment you want to send.
Set the shipment details.
Set the shippers address in case the shipment can't be delivered it will be returned to that address.
Set the receivers address.
Add up to 30 shipment orders into an array.
Set up the request object, call the createShipmentOrder function and get its response.
To check if the request was successful use the hasNoErrors function. If the request itself or any of the creation state objects have errors you can display their messages.
Usage for the tracking api
The following is an example of the getPieceDetail function. If you only track shipments you have sent yourself this is the best function to use, because it contains all data getPiece and getPieceEvents will return in one request. However, this request only works with shipment numbers of shipments you have sent with the same business customer account you are using the zt token of.
Set up the request object, call the getPieceDetail function and get its response.
To check if the request was successful use the hasNoErrors function. If the request itself or any child object does not have the status code "0", which is = success, this will return false.
If you want to track shipments that you have not sent yourself you can use the getStatusForPublicUser function. This function contains less data, but works with all shipment numbers. You can also request more than one shipment number.
Please also keep in mind, that for some reason DHL decided to disable this function in sandbox mode. So you need to use production mode to test it.
Set up the pieces you want to request
Set up the request object, call the getStatusForPublicUser function and get its response.
To check if the request was successful use the hasNoErrors function. If the request itself or any child object does not have the status code "0", which is = success, this will return false.
Documentation
- There is an official documentation by DHL found here. However it is partly outdated and incomplete.
- A documentation page for this project can be found here.
Support
- For reporting bugs and suggestions please use the issues tab.
- If you have any questions feel free to contact me by mail [email protected].
License
This project is licensed under the MIT license. Please read the LICENSE file for details.
All versions of dhl-business-shipping with dependencies
ext-soap Version *
ext-curl Version *
ext-simplexml Version *