PHP code example of chrometoaster / sitehost-api-client

1. Go to this page and download the library: Download chrometoaster/sitehost-api-client 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/ */

    

chrometoaster / sitehost-api-client example snippets


use Chrometoaster\SiteHost\API\Client as SiteHostAPIClient;

$env_api_key   = getenv('SITEHOST_API_KEY');
$env_client_id = getenv('SITEHOST_CLIENT_ID');

// create a client
$client = new SiteHostAPIClient($env_api_key, $env_client_id);

// read cloud stack info
$info = $client->getStackInfo('ex-myserver', 'abc123def456ab12');

// check the response is valid and has data
if ($info->isValid()) {
    // work with the information here
    ...
    ... 
}