PHP code example of lob / lob-php

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

    

lob / lob-php example snippets





 Configure HTTP basic authorization: basicAuth
$config = OpenAPI\Client\Configuration::getDefaultConfiguration()
              ->setUsername('YOUR_USERNAME')
              ->setPassword('YOUR_PASSWORD');


$apiInstance = new OpenAPI\Client\Api\AddressesApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$address_editable = new \OpenAPI\Client\Model\AddressEditable(); // \OpenAPI\Client\Model\AddressEditable

try {
    $result = $apiInstance->addressCreate($address_editable);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling AddressesApi->addressCreate: ', $e->getMessage(), PHP_EOL;
}

bash
$ echo "LOB_API_TEST_KEY=<<YOUR TEST KEY>> LOB_API_LIVE_KEY=<<YOUR LIVE KEY>>" > LOCAL.env