PHP code example of forgie1 / toptrans-api-wrapper

1. Go to this page and download the library: Download forgie1/toptrans-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/ */

    

forgie1 / toptrans-api-wrapper example snippets


    $order = new Order();
    $order->setLoading($loading)
        ->setDischarge($discharge)
        ->setPacks($packs)
        ->setOrderValue($orderValue)
    // build order entity here ...

    $method = new OrderSaveMethod($order)
    $request = new Request ('userName', 'password');

    try {
        $response = $method->sendRequest($request)
    } catch (ResponseStatusException $e) {
        // handle Exception
    }