PHP code example of infrawrench / sdk

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

    

infrawrench / sdk example snippets




nfrawrench\Sdk\APIV1Client;
use Infrawrench\Sdk\ApiException;

$client = new APIV1Client(
    apiKey: getenv('INFRAWRENCH_API_KEY') ?: null,
    orgId: getenv('INFRAWRENCH_ORG_ID') ?: null,
);

try {
    foreach ($client->accounts->list() as $account) {
        echo $account->id, "\n";
    }
} catch (ApiException $e) {
    echo $e->status, ' ', $e->errorCode ?? '(no code)', "\n";
}

$client->accounts->list(options: new RequestOptions(timeout: 5.0));

$client = new APIV1Client(orgId: 'org_1', sender: $recordingSender);