PHP code example of google / cloud-assured-workloads

1. Go to this page and download the library: Download google/cloud-assured-workloads 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-assured-workloads example snippets




use Google\Cloud\AssuredWorkloads\V1beta1\AssuredWorkloadsServiceClient;

$client = new AssuredWorkloadsServiceClient();

$workloads = $client->listWorkloads(
    AssuredWorkloadsServiceClient::locationName('[MY_ORGANIZATION]', 'us-west1')
);

foreach ($workloads as $workload) {
    print 'Workload: ' . $workload->getName() . PHP_EOL;
}