PHP code example of misterbrownrsa / laravel-dhl-tas

1. Go to this page and download the library: Download misterbrownrsa/laravel-dhl-tas 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/ */

    

misterbrownrsa / laravel-dhl-tas example snippets


$products = [];
foreach ($cart->items as $cartItem) {
    $products[] = [
        'name'     => $cartItem->warehouse->product->name,
        'price'    => $cartItem->price,
        'quantity' => $cartItem->quantity,
        'weight'   => $cartItem->warehouse->product->weight,
        'hscode'   => "6404.1900", //retrieved from their HSCode systems
    ];
}

$TAS = new \MisterBrownRSA\DHL\TAS\DHLTAS();
$TAS->addProduct($products);
$TAS->total($cart->subtotal);
$TAS->reference('A1AQV');
$TAS->toCountry('ZW');
$results = $TAS->doCurlPost();

dump($TAS->toXMML());

dump($TAS->doCurlPost());