tatilcom/gcp-rest-guzzle-adapter
最新稳定版本:v1.0.2
Composer 安装命令:
composer require tatilcom/gcp-rest-guzzle-adapter
包简介
Simple Guzzle adapter to Google Cloud Platform REST endpoints
README 文档
README
Simple Guzzle adapter to Google Cloud Platform REST APIs
Use Case
Accessing to Google Cloud Platform Rest APIs using Service Account Credentials (Google's recommended way)
For more information about authentication: https://cloud.google.com/speech/docs/common/auth
Usage
use \GcpRestGuzzleAdapter\Client\ClientFactory; // Service Account Email $email = 'pubsub@test-project123.iam.gserviceaccount.com'; // 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());
Result
string(113) "{ "subscriptions": [ "projects/test-project123/subscriptions/test_topicSubscriber" ] } "
Requirements
- php >=5.6
- guzzle 5.3
- firebase/php-jwt 4.0
- apc or apcu for token caching (custom handler also injectable)
统计信息
- 总下载量: 1.13k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-01-16