PHP code example of google / cloud-recommender
1. Go to this page and download the library: Download google/cloud-recommender 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-recommender example snippets
use Google\Cloud\Recommender\V1\RecommenderClient;
$client = new RecommenderClient();
$recommendations = $client->listRecommendations(
RecommenderClient::recommenderName(
'[MY_PROJECT_ID]',
'us-central1',
'google.compute.instance.MachineTypeRecommender'
)
);
foreach ($recommendations as $recommendation) {
printf(
'Found recommendation: %s' . PHP_EOL,
$recommendation->getName()
);
}