PHP code example of google / cloud-redis
1. Go to this page and download the library: Download google/cloud-redis 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-redis example snippets
use Google\Cloud\Redis\V1\CloudRedisClient;
$client = new CloudRedisClient();
$projectId = '[MY_PROJECT_ID]';
$location = '-'; // The '-' wildcard refers to all regions available to the project for the listInstances method
$formattedLocationName = $client->locationName($projectId, $location);
$response = $client->listInstances($formattedLocationName);
foreach ($response->iterateAllElements() as $instance) {
printf('Instance: %s : %s' . PHP_EOL,
$instance->getDisplayName(),
$instance->getName()
);
}