PHPackages                             petitpress/gps-messenger-bundle - 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. [Queues &amp; Workers](/categories/queues)
4. /
5. petitpress/gps-messenger-bundle

ActiveSymfony-bundle[Queues &amp; Workers](/categories/queues)

petitpress/gps-messenger-bundle
===============================

Google Pub/Sub transport for Symfony Messenger

3.2.0(1y ago)29491.0k↓13.5%21[3 PRs](https://github.com/petitpress/gps-messenger-bundle/pulls)2MITPHPPHP &gt;=8.2

Since Nov 11Pushed 3mo ago7 watchersCompare

[ Source](https://github.com/petitpress/gps-messenger-bundle)[ Packagist](https://packagist.org/packages/petitpress/gps-messenger-bundle)[ Docs](https://www.petitpress.sk)[ RSS](/packages/petitpress-gps-messenger-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (16)Versions (29)Used By (2)

Google Pub/Sub transport implementation for Symfony Messenger
=============================================================

[](#google-pubsub-transport-implementation-for-symfony-messenger)

This bundle provides a simple implementation of Google Pub/Sub transport for Symfony Messenger.

The bundle requires only `symfony/messenger`, `google/cloud-pubsub` and `symfony/options-resolver` packages. In contrast with [Enqueue GPS transport](https://github.com/php-enqueue/gps), it doesn't require [Enqueue](https://github.com/php-enqueue)and [some bridge](https://github.com/sroze/messenger-enqueue-transport#readme).

Features
--------

[](#features)

- **Compatible with the latest `google/cloud-pubsub` 2.**\*.
- **Zero extra dependencies** beyond core Symfony (e.g. `Symfony Messenger`) and Pub/Sub libraries.
- **Flexible and extensive configuration**, available via options or DSN (Data Source Name), including `deadLetterPolicy`, `enableMessageOrdering`, `ackDeadlineSeconds`).
- **Automatic Pub/Sub Topic and Subscription creation**, with the ability to disable it if needed.
- **Message ordering support** using the `OrderingKeyStamp`.
- **Keep-alive support** for long-running Messenger workers.

Support
-------

[](#support)

VersionStatusSymfony Versions[3.x](https://github.com/petitpress/gps-messenger-bundle/tree/3.x)Actively Supported&gt;= 5.4, &lt;8.0[4.x](https://github.com/petitpress/gps-messenger-bundle/tree/master)In development&gt;= 7.4Installation
------------

[](#installation)

### Step 1: Install the Bundle

[](#step-1-install-the-bundle)

From within container execute the following command to download the latest version of the bundle:

```
$ composer require petitpress/gps-messenger-bundle --no-scripts
```

### Step 2: Configure environment variables

[](#step-2-configure-environment-variables)

Official [Google Cloud PubSub SDK](https://github.com/googleapis/google-cloud-php-pubsub)requires some globally accessible environment variables.

You might need to change default Symfony DotEnv instance to use `putenv`as Google needs to access some variables through `getenv`. To do so, use putenv method in `config/bootstrap.php`:

```
(new Dotenv())->usePutenv()->...
```

List of Google Pub/Sub configurable variables :

```
# use these for production environment:
GOOGLE_APPLICATION_CREDENTIALS='google-pubsub-credentials.json'
GCLOUD_PROJECT='project-id'

# use these for development environment (if you have installed Pub/Sub emulator):
PUBSUB_EMULATOR_HOST=http://localhost:8538
```

or if you have credentials in a base64 encoded env variable:

```
# config/packages/messenger.yaml

framework:
    messenger:
        transports:
            gps_transport:
                dsn: 'gps://default'
                options:
                    client_config:
                        credentials: '%env(json:base64:GOOGLE_PUBSUB_KEY)%'
```

### Step 3: Configure Symfony Messenger

[](#step-3-configure-symfony-messenger)

```
# config/packages/messenger.yaml

framework:
    messenger:
        transports:
            gps_transport:
                dsn: 'gps://default'
                options:
                    client_config: # optional (default: [])
                        apiEndpoint: 'https://europe-west3-pubsub.googleapis.com'
                    topic: # optional (default name: messages)
                        name: 'messages'
                        options: # optional create options if not exists (default: []), for all options take at look at https://cloud.google.com/php/docs/reference/cloud-pubsub/latest/Topic#_Google_Cloud_PubSub_Topic__create__
                            labels:
                                - label1
                                - label2
                    subscription: # optional (default the same as topic.name)
                        name: 'messages'
                        options: # optional create options if not exists (default: []), for all options take a look at https://cloud.google.com/php/docs/reference/cloud-pubsub/latest/Subscription#_Google_Cloud_PubSub_Subscription__create__
                            enableExactlyOnceDelivery: true
                            labels:
                                - label1
                                - label2
                        pull:
                            maxMessages: 10 # optional (default: 10)
```

or:

```
# config/packages/messenger.yaml

framework:
    messenger:
        transports:
            gps_transport:
                dsn: 'gps://default/messages?client_config[apiEndpoint]=https://europe-west3-pubsub.googleapis.com&subscription[pull][maxMessages]=10'
```

to use emulator in local:

```
# config/packages/dev/messenger.yaml

framework:
    messenger:
        transports:
            gps_transport:
                options:
                    client_config:
                        hasEmulator: true
                        emulatorHost: '%env(PUBSUB_EMULATOR_HOST)%'
```

### Step 4: Configure PetitPressGpsMessengerBundle (optional)

[](#step-4-configure-petitpressgpsmessengerbundle-optional)

Configure the cache service where authentication tokens are stored. The default is `cache.app`.

```
# config/packages/petit_press_gps_messenger.yaml

petit_press_gps_messenger:
    auth_cache: 'cache.app'
```

### Step 5: Use available stamps if needed

[](#step-5-use-available-stamps-if-needed)

- `OrderingKeyStamp`: use for keeping messages of the same context in order. For more information, read an [official documentation](https://cloud.google.com/pubsub/docs/publisher#using_ordering_keys).
- `AttributesStamp`: use to add contextual metadata to serialized messages. For more information, read an [official documentation](https://cloud.google.com/pubsub/docs/publisher#using-attributes). Can be very useful when used together with [subscription filters](https://cloud.google.com/pubsub/docs/subscription-message-filter).
- `GpsSenderOptionsStamp`: use to specify options for the second parameter of the `publish` method in the Pub/Sub client.

### Step 6: Create topics from config

[](#step-6-create-topics-from-config)

```
bin/console messenger:setup-transports
```

License
-------

[](#license)

This bundle is released under the [MIT License](LICENSE).

###  Health Score

59

—

FairBetter than 99% of packages

Maintenance67

Regular maintenance activity

Popularity49

Moderate usage in the ecosystem

Community30

Small or concentrated contributor base

Maturity77

Established project with proven stability

 Bus Factor1

Top contributor holds 51% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~87 days

Recently: every ~45 days

Total

20

Last Release

350d ago

Major Versions

0.1.2 → 1.0.02021-01-06

1.6.0 → 2.0.02024-01-03

2.1.0 → 3.0.02024-06-04

PHP version history (2 changes)0.1.0PHP &gt;=7.4.0

2.0.0PHP &gt;=8.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/19769026?v=4)[Ronald Márföldi](/maintainers/marforon)[@marforon](https://github.com/marforon)

![](https://avatars.githubusercontent.com/u/18593654?v=4)[Lubomir Stanko](/maintainers/stankolubomir)[@stankolubomir](https://github.com/stankolubomir)

![](https://www.gravatar.com/avatar/6e0eb41fcebd2cea5ea138010e8e7782bb92ad57037aa0652ec18d15661ae3f3?d=identicon)[PetitPress a.s.](/maintainers/PetitPress%20a.s.)

---

Top Contributors

[![pulzarraider](https://avatars.githubusercontent.com/u/960844?v=4)](https://github.com/pulzarraider "pulzarraider (26 commits)")[![marforon](https://avatars.githubusercontent.com/u/19769026?v=4)](https://github.com/marforon "marforon (10 commits)")[![vilain-corentin](https://avatars.githubusercontent.com/u/26303058?v=4)](https://github.com/vilain-corentin "vilain-corentin (3 commits)")[![Creeperface01](https://avatars.githubusercontent.com/u/10363500?v=4)](https://github.com/Creeperface01 "Creeperface01 (2 commits)")[![mickprev](https://avatars.githubusercontent.com/u/17760158?v=4)](https://github.com/mickprev "mickprev (2 commits)")[![damienfern](https://avatars.githubusercontent.com/u/22883097?v=4)](https://github.com/damienfern "damienfern (2 commits)")[![DamienLinux](https://avatars.githubusercontent.com/u/60408700?v=4)](https://github.com/DamienLinux "DamienLinux (1 commits)")[![sontungpham](https://avatars.githubusercontent.com/u/101813519?v=4)](https://github.com/sontungpham "sontungpham (1 commits)")[![HeahDude](https://avatars.githubusercontent.com/u/10107633?v=4)](https://github.com/HeahDude "HeahDude (1 commits)")[![sakulb](https://avatars.githubusercontent.com/u/95277083?v=4)](https://github.com/sakulb "sakulb (1 commits)")[![jon-ht](https://avatars.githubusercontent.com/u/17051512?v=4)](https://github.com/jon-ht "jon-ht (1 commits)")[![kilatib](https://avatars.githubusercontent.com/u/2750628?v=4)](https://github.com/kilatib "kilatib (1 commits)")

---

Tags

googlegoogle-cloud-pubsubgoogle-cloud-sdkmessage-queuephpsymfonysymfony-bundlesymfony-messengersymfonygoogleMessengerpubsub

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Psalm

Code StyleECS

Type Coverage Yes

### Embed Badge

![Health badge](/badges/petitpress-gps-messenger-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/petitpress-gps-messenger-bundle/health.svg)](https://phpackages.com/packages/petitpress-gps-messenger-bundle)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[contao/core-bundle

Contao Open Source CMS

1231.6M2.4k](/packages/contao-core-bundle)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.2M386](/packages/shopware-core)[koco/messenger-kafka

Symfony Messenger Kafka Transport

931.1M1](/packages/koco-messenger-kafka)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
