luqman-v1/pubsub
Composer 安装命令:
composer require luqman-v1/pubsub
包简介
package pubsub google cloud for laravel
README 文档
README
Simple package Laravel 5.2 for using Google Cloud PubSub
Installation
composer require luqman-v1/pubsub
Register the service provider in app.php
'providers' => [ // ... LuqmanV1\PubSub\PubSubServiceProvider::class, ]
Register the facade in app.php
'aliases' => [ // ... 'PubSub' => LuqmanV1\PubSub\Facade::class, ]
First convert the credential.json file to base64 https://www.base64decode.org/
The package has a default configuration which uses the following environment variables.
GCP_CREDENTIALS=SomeAwesomeBase64
Usage
//for publish message $message = [ 'data' => 'My new message.', 'attributes' => [ 'location' => 'Detroit', ], ]; PubSub::publish("someTopicName", $message); //for pull message $messages = PubSub::pull("someSubcriberName"); foreach($messages as $message){ echo $message->data() . "\n"; echo $message->attribute('location'); } //for another function like create topic or etc call function : PubSub::pubsub()->methodYouWantUse(); example : PubSub::pubsub()->createTopic('someNewTopicName');
License
MIT
统计信息
- 总下载量: 4.07k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-03-24