PHP code example of postmen / sdk-php
1. Go to this page and download the library: Download postmen/sdk-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/ */
postmen / sdk-php example snippets
$loader =
use Postmen\Postmen;
$api_key = 'YOUR_API_KEY';
$region = 'sandbox';
// create Postmen API handler object
$api = new Postmen($api_key, $region);
try {
// as an example we request all the labels
$result = $api->get('labels');
echo "RESULT:\n";
print_r($result);
} catch (exception $e) {
// if error occurs we can access all
// the details in following way
echo "ERROR:\n";
echo $e->getCode() . "\n"; // error code
echo $e->getMessage() . "\n"; // error message
print_r($e->getDetails()); // details
}
composer