Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Gps Messenger Bundle Laravel Package

petitpress/gps-messenger-bundle

Laravel bundle for GPS Messenger: send and receive location-based messages, integrate tracking updates, and manage messaging workflows via simple configuration. Designed to drop into existing apps with minimal setup for GPS-enabled notifications and events.

View on GitHub
Deep Wiki
Context7

Google Pub/Sub 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, it doesn't require Enqueue and some bridge.

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

Version Status Symfony Versions
3.x Actively Supported >= 5.4, <8.0
4.x Actively Supported >= 7.4

Installation

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

Official Google Cloud PubSub SDK 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

# 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)

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

  • OrderingKeyStamp: use for keeping messages of the same context in order. For more information, read an official documentation.

  • AttributesStamp: use to add contextual metadata to serialized messages. For more information, read an official documentation. Can be very useful when used together with subscription filters.

  • GpsSenderOptionsStamp: use to specify options for the second parameter of the publish method in the Pub/Sub client.

Step 6: Create topics from config

bin/console messenger:setup-transports

License

This bundle is released under the MIT License.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
symfony/ai-mate-composer-plugin
f-froehlich/utils
ezsystems/templated-uri-router
ezsystems/hybrid-platform-ui-core-components
ezsystems/hybrid-platform-ui-assets
ezsystems/platform-ui-bundle
ezsystems/ezcommerce-demo-assets
vaites/php-apache-tika
exsyst/worker
exsyst/io
exsyst/security
patchlevel/event-sourcing-phpunit
genkgo/camt
patchlevel/event-sourcing
patchlevel/event-sourcing-bundle
tales-from-a-dev/flowbite-bundle
ergnuor/table-data-gateway
ergnuor/serializer
ergnuor/domain-model
ergnuor/criteria