https://github.com/tredmann/dhl-php-sdk
Unofficial DHL PHP SDK based on the DHL API
https://github.com/tredmann/dhl-php-sdk
Last synced: 9 months ago
JSON representation
Unofficial DHL PHP SDK based on the DHL API
- Host: GitHub
- URL: https://github.com/tredmann/dhl-php-sdk
- Owner: tredmann
- Created: 2013-11-27T15:02:37.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2015-02-03T15:55:31.000Z (over 11 years ago)
- Last Synced: 2025-09-21T23:42:18.298Z (9 months ago)
- Language: PHP
- Size: 113 KB
- Stars: 34
- Watchers: 12
- Forks: 14
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# DHL PHP SDK
This *unofficial* library is wrapping some functions of the DHL SOAP API in order to easy create shipments and labels.
## Motivation
I had a lot of pain studying and programming the DHL SOAP API - just to wrap some bits in a lot of XML. There is a lot, but not very helpful, documentation to the API. So I decided to create some functions in an easy to use and understand library.
## Prerequirements
You need a DHL developer account and - as long as you want to use the API in production systems - a DHL Intraship Account.
## Usage
First of all you need to create the Shipment Object with your credentials and some information from you as shipper.
// your customer and api credentials from/for dhl
$credentials = array(
'user' => 'geschaeftskunden_api',
'signature' => 'Dhl_ep_test1',
'ekp' => '5000000000',
'api_user' => '',
'api_password' => '',
'log' => true
);
// your company info
$info = array(
'company_name' => 'Kindehochdrei GmbH',
'street_name' => 'Clayallee',
'street_number' => '241',
'zip' => '14165',
'country' => 'germany',
'city' => 'Berlin',
'email' => 'bestellung@kindhochdrei.de',
'phone' => '01788338795',
'internet' => 'http://www.kindhochdrei.de',
'contact_person' => 'Nina Boeing'
);
With these infos you can create the object:
$dhl = new DHLBusinessShipment($credentials, $info);
To create a shipment and get the shipment number and label, just create the receiver details:
// receiver details
$customer_details = array(
'first_name' => 'Tobias',
'last_name' => 'Redmann',
'c/o' => '',
'street_name' => 'Hocksteinweg',
'street_number' => '11',
'country' => 'germany',
'zip' => '14165',
'city' => 'Berlin'
);
And the create a shipment
$response = $dhl->createNationalShipment($customer_details);
After that, you can read the shipment infos
if($response !== false) {
var_dump($response);
} else {
var_dump($dhl->errors);
}
That's all. More will be hopefully coming soon.
## Using the live API
To use it in live environment, please create the Client as none sandboxed:
$dhl = new DHLBusinessShipment($credentials, $info, false);
You need also to change the credentials a bit:
// your customer and api credentials from/for dhl
$credentials = array(
'user' => 'geschaeftskunden_api',
'signature' => 'Dhl_ep_test1',
'ekp' => '5000000000',
'api_user' => '',
'api_password' => '',
'log' => true
);
`user`: Use the intraship username
`signature`: intraship password
`ekp`: Your dhl customer id
`api_user`: App ID from developer account
`api_password`: App token from developer account
## WordPress and WooCommerce
I build several Plugins for WordPress and WooCommerce - feel free to ask me for that.
*Contact*
Check out my website: [www.tricd.de](http://www.tricd.de)