PHP code example of andyts93 / brt-api-wrapper

1. Go to this page and download the library: Download andyts93/brt-api-wrapper 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/ */

    

andyts93 / brt-api-wrapper example snippets


$request = new Andyts93\BrtApiWrapper\CreateRequest();
$request->setDepartureDepot(123)
    ->setSenderCustomerCode(1234567)
    ->setDeliveryFreightTypeCode('DAP')
    ->setConsigneeCompanyName('Fake Company Inc.')
    ->setConsigneeAddress('Fake street')
    ->setConsigneeZIPCode('00000')
    ->setConsigneeCity('Fake city')
    ->setConsigneeCountryAbbreviationISOAlpha2('IT')
    ->setNumberOfParcels(1)
    ->setWeightKG(1)
    ->setNumericSenderReference(123456)
    ->setIsCODMandatory(0)
    ->setIsLabelRequired(1)
    ->setLabelParameters(new Andyts93\BrtApiWrapper\LabelParameter());

$response = $request->call();

if ($response->hasErrorrs()) {
    echo $response->getExecutionMessage()->getMessage();
}

$request = new Andyts93\BrtApiWrapper\ConfirmRequest();
$request->setSenderCustomerCode(1234567)
    ->setNumericSenderReference(123456);

$response = $request->call();

if ($response->hasErrorrs()) {
    echo $response->getExecutionMessage()->getMessage();
}

$request = new Andyts93\BrtApiWrapper\DeleteRequest();
$request->setSenderCustomerCode(1234567)
    ->setNumericSenderReference(123456);

$response = $request->call();

if ($response->hasErrorrs()) {
    echo $response->getExecutionMessage()->getMessage();
}