PHP code example of tatilcom / gcp-rest-guzzle-adapter
1. Go to this page and download the library: Download tatilcom/gcp-rest-guzzle-adapter 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/ */
tatilcom / gcp-rest-guzzle-adapter example snippets
use \GcpRestGuzzleAdapter\Client\ClientFactory;
// Service Account Email
$email = '[email protected]';
// Private Key
$key = '-----BEGIN PRIVATE KEY-----SDADAavaf...-----END PRIVATE KEY-----';
// Scope of Google Cloud Service
$scope = 'https://www.googleapis.com/auth/pubsub';
// Full base url of project
$projectBaseUrl = 'https://pubsub.googleapis.com/v1/projects/test-project123/';
$pubSubClient = ClientFactory::createClient($email, $key, $scope, $projectBaseUrl);
$result = $pubSubClient->get(
sprintf('topics/%s/subscriptions', 'test-topic')
);
var_dump((string)$result->getBody()->getContents());
string(113) "{
"subscriptions": [
"projects/test-project123/subscriptions/test_topicSubscriber"
]
}
"