PHP code example of google / cloud-retail
1. Go to this page and download the library: Download google/cloud-retail 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-retail example snippets
use Google\Cloud\Retail\V2\CatalogServiceClient;
$client = new CatalogServiceClient();
$catalogs = $client->listCatalogs(
CatalogServiceClient::locationName('[MY_PROJECT_ID]', 'global')
);
foreach ($catalogs as $catalog) {
print 'Catalog: ' . $catalog->getName() . PHP_EOL;
}