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
Laravel Pubsub Queue

Laravel Pubsub Queue Laravel Package

kainxspirits/laravel-pubsub-queue

Laravel queue driver for Google Cloud Pub/Sub. Configure a pubsub connection with project, queue/topic naming, retries and timeouts, and optional auto-creation of topics/subscriptions. Ideal for running Laravel jobs over Pub/Sub with minimal setup.

View on GitHub
Deep Wiki
Context7

A Laravel queue driver for Google PubSub.

Frequently asked questions about Laravel Pubsub Queue
How do I install and set up the Laravel PubSub Queue package for Google Cloud Pub/Sub?
Install via Composer with `composer require kainxspirits/laravel-pubsub-queue`, then register the service provider in `config/app.php` if package discovery is disabled. Configure the `pubsub` driver in `config/queue.php` using your Google Cloud project ID, subscription name, and other Pub/Sub settings. Ensure the `google/cloud-pubsub` SDK is installed as a dependency.
Which Laravel versions does this package support, and are there breaking changes?
The package is designed for Laravel 10+ and may not support older versions without adjustments. Always check the package’s changelog or GitHub issues for breaking changes, especially when upgrading Laravel. Test thoroughly in a staging environment before production deployment.
Can I use this package alongside other Laravel queue drivers like Redis or database?
Yes, the PubSub Queue driver can coexist with other Laravel queue drivers. You can dispatch jobs to different queues (e.g., `pubsub`, `redis`, `database`) and route them accordingly. This allows for phased adoption or hybrid workflows where Pub/Sub is only needed for specific use cases.
How do I handle job failures or retries in Google Cloud Pub/Sub with this package?
Configure retry logic in `config/queue.php` under the `pubsub` driver (e.g., `retries => 3`). For failed jobs, use Laravel’s `failed` event or dead-letter queues by setting up a separate Pub/Sub subscription for failed messages. Monitor Pub/Sub metrics in the Google Cloud Console for backlog or latency issues.
What are the performance implications of using PubSub for Laravel queues compared to Redis or database?
Pub/Sub introduces network latency due to Google Cloud’s distributed nature, which may be higher than in-memory queues like Redis. However, it excels in scalability and fan-out scenarios. Benchmark your workloads, especially for high-throughput jobs, and consider using push subscriptions for near-real-time processing if low latency is critical.
How do I secure my Google Cloud Pub/Sub credentials for Laravel’s environment?
Store your Google Cloud service account credentials securely in Laravel’s `.env` file (e.g., `PUBSUB_CREDENTIALS_PATH=path/to/key.json`). Avoid hardcoding credentials in your codebase. For production, use Google’s Application Default Credentials or a secrets manager like HashiCorp Vault for enhanced security.
Does this package support ordered job processing (FIFO) in Pub/Sub?
Yes, you can enable FIFO processing by configuring an ordering key in your Pub/Sub topic. Set the `ordering_key` in your `config/queue.php` under the `pubsub` driver or pass it dynamically when dispatching jobs. Note that ordering keys require Pub/Sub’s FIFO-enabled topics, which may incur additional costs.
What’s the best way to monitor job processing and Pub/Sub metrics in production?
Use Google Cloud’s Monitoring and Logging tools to track Pub/Sub metrics like subscription backlog, publish latency, and push request volumes. For Laravel-specific monitoring, integrate tools like Laravel Horizon or custom Tailable Pub/Sub subscriptions to log job failures or processing times. Set up alerts for abnormal backlogs or retry spikes.
Can I fall back to a local queue (e.g., database) if Pub/Sub is unavailable?
The package doesn’t include built-in fallback logic, but you can implement a hybrid approach by dispatching jobs to multiple queues (e.g., `pubsub` and `database`). Use Laravel’s queue middleware or a custom job resolver to route jobs dynamically based on Pub/Sub availability. Test this logic thoroughly to avoid job duplication or loss.
Are there alternatives to this package for Laravel Pub/Sub integration, and how do they compare?
Alternatives include custom implementations using the `google/cloud-pubsub` SDK directly or third-party packages like `spatie/laravel-pubsub`. This package stands out for its seamless Laravel queue integration, minimal configuration, and support for Pub/Sub’s advanced features like push subscriptions and dead-letter topics. Compare based on your needs for scalability, ease of use, and Google Cloud-specific features.
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.
terminal42/code-quality-tools
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky