PHPackages                             gdg-tangier/cloud-pubsub - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. gdg-tangier/cloud-pubsub

ActiveLibrary[Framework](/categories/framework)

gdg-tangier/cloud-pubsub
========================

Google Cloud pub-sub for laravel

v0.1.3(6y ago)5054.9k↓29.9%6MITPHPCI failing

Since Sep 21Pushed 3y ago3 watchersCompare

[ Source](https://github.com/gdg-tangier/cloud-pubsub)[ Packagist](https://packagist.org/packages/gdg-tangier/cloud-pubsub)[ RSS](/packages/gdg-tangier-cloud-pubsub/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (2)Versions (3)Used By (0)

Laravel Cloud Pub/Sub.
----------------------

[](#laravel-cloud-pubsub)

[![](https://camo.githubusercontent.com/d47c886155c3971ed2ecdedb4d858615c85bf7b024be8ea26510ce7e12fc4ced/68747470733a2f2f692e696d6775722e636f6d2f587950594e45742e6a7067)](https://camo.githubusercontent.com/d47c886155c3971ed2ecdedb4d858615c85bf7b024be8ea26510ce7e12fc4ced/68747470733a2f2f692e696d6775722e636f6d2f587950594e45742e6a7067)

 [![](https://github.com/gdg-tangier/cloud-pubsub/actions/workflows/tests.yml/badge.svg)](https://github.com/gdg-tangier/cloud-pubsub/actions/workflows/tests.yml/badge.svg)[![](https://camo.githubusercontent.com/b6ee655bfe14b2cf4a24f1677d6d4544aad3c440b6357c8c67d762bcda48ba28/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3230363432303534302f736869656c643f6272616e63683d6d6173746572)](https://camo.githubusercontent.com/b6ee655bfe14b2cf4a24f1677d6d4544aad3c440b6357c8c67d762bcda48ba28/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3230363432303534302f736869656c643f6272616e63683d6d6173746572)[![](https://camo.githubusercontent.com/e954ebd986bbad4c6d11a3f6c92b5a1afd5a55cbde549f4287c962a1f71f780a/68747470733a2f2f706f7365722e707567782e6f72672f6764672d74616e676965722f636c6f75642d7075627375622f762f737461626c652e737667)](https://camo.githubusercontent.com/e954ebd986bbad4c6d11a3f6c92b5a1afd5a55cbde549f4287c962a1f71f780a/68747470733a2f2f706f7365722e707567782e6f72672f6764672d74616e676965722f636c6f75642d7075627375622f762f737461626c652e737667)[![](https://camo.githubusercontent.com/e88d3e92c73d3a5943d30a539696408590264a01ccc01d014805d7fb7c811d8a/68747470733a2f2f706f7365722e707567782e6f72672f6764672d74616e676965722f636c6f75642d7075627375622f6c6963656e73652e737667)](https://camo.githubusercontent.com/e88d3e92c73d3a5943d30a539696408590264a01ccc01d014805d7fb7c811d8a/68747470733a2f2f706f7365722e707567782e6f72672f6764672d74616e676965722f636c6f75642d7075627375622f6c6963656e73652e737667)[![](https://camo.githubusercontent.com/5dc33dc453936987e8423b2e93ebdb1955ecc7187cc664824ca4a957aecb85c2/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6275696c74253230666f722d6c61726176656c2d626c75652e737667)](https://camo.githubusercontent.com/5dc33dc453936987e8423b2e93ebdb1955ecc7187cc664824ca4a957aecb85c2/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6275696c74253230666f722d6c61726176656c2d626c75652e737667)

### Why?

[](#why)

Build a scalable Laravel apps using event-driven microservices architecture (Pub/Sub), this tool adds the ability for your Laravel applications to communicate with each other using [Google Cloud Pub/Sub](https://cloud.google.com/pubsub/docs).

### Define your architecture.

[](#define-your-architecture)

First of all, you need to create subscriptions and topics in Google Cloud Platform, or you can use the cli.

- [Quickstart using the gcloud command-line tool](https://cloud.google.com/pubsub/docs/quickstart-cli)

### Installation.

[](#installation)

- `composer require gdg-tangier/cloud-pubsub`

### Configuration.

[](#configuration)

- `config/queue.php`

You can define multiple subscribers (queue connections) config in `config/queue.php`, the app can subscribe to multiple subscriptions.

Example.

```
'pubsub' => [
      'driver' => 'pubsub',
      'queue'  => env('SUBSCRIPTION'),
      'credentials' => [
          'keyFilePath' => storage_path(env('PUBSUB_CLIENT_KEY')), // credentials file path '.json'
          'projectId'   => env('GCP_PROJECT_ID'),
      ],
  ],
```

- `config/pubsub.php`

Here where you can define your `subscriptions` jobs, events and topics mappings.

Example.

```
