PHP code example of jackbayliss / laravel-dhl-api

1. Go to this page and download the library: Download jackbayliss/laravel-dhl-api library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

jackbayliss / laravel-dhl-api example snippets


$quote = new \jackbayliss\DHLApi\Calls\GetQuote();
$quote->declaredValue(10)->reference("0999999999990393939333333333")
->currency("GBP")->toCountryCode("DE")->toPostalCode("91056")->setPieces([
 array("height" => 10,"width" => 10 ,"depth" => 2,"weight" => 0.5)
]);

$quote->getResponse();


 $tracking = new \jackbayliss\DHLApi\Calls\GetTracking();
 $tracking = $tracking->reference("0999999999990393939333333333")->trackingNumber("8564385550");
 $tracking->getResponse();

$routing = new  \jackbayliss\DHLApi\Calls\GetRouting();

$routing = $routing->reference("0999999999990393939333333333")->address([
'RegionCode' => 'EU', 
'RequestType' => 'O', 
'Address1'  => 'Oracle Parkway,',
'Address2' => 'Thames Valley Park (TVP)', 
'Address3' => 'Berkshire', 
'PostalCode' => 'RG6 1RA',
'City' => 'Reading',
'Division' => 'RE',
'CountryCode' => 'GB',
'CountryName' => 'United Kingdom', 
'OriginCountryCode' => 'GB'
]);

$routing->getResponse();