PHP code example of google / shopping-merchant-quota

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


Google\ApiCore\ApiException;
Google\ApiCore\PagedListResponse;
Google\Shopping\Merchant\Quota\V1\Client\QuotaServiceClient;
Google\Shopping\Merchant\Quota\V1\ListQuotaGroupsRequest;
Google\Shopping\Merchant\Quota\V1\QuotaGroup;

// Create a client.
$quotaServiceClient = new QuotaServiceClient();

// Prepare the request message.
$request = (new ListQuotaGroupsRequest())
    ->setParent($formattedParent);

// Call the API and handle any network failures.
try {
    /** @var PagedListResponse $response */
    $response = $quotaServiceClient->listQuotaGroups($request);

    /** @var QuotaGroup $element */
    foreach ($response as $element) {
        printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
    }
} catch (ApiException $ex) {
    printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}