PHP code example of google / cloud-compute
1. Go to this page and download the library: Download google/cloud-compute 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/ */
google / cloud-compute example snippets
use Google\Cloud\Compute\V1\InstancesClient;
$instances = new InstancesClient();
foreach ($instances->list('[MY_PROJECT_ID]', 'us-west1') as $instance) {
print($instance->getName() . PHP_EOL);
}