PHPackages                             digitalmanagerguru/laravel-pubsub-queue - 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. digitalmanagerguru/laravel-pubsub-queue

ActiveLibrary[Queues &amp; Workers](/categories/queues)

digitalmanagerguru/laravel-pubsub-queue
=======================================

Queue driver for Google Cloud Pub/Sub.

3.1.0(4w ago)05.5k↑72.7%MITPHPPHP &gt;=8.1

Since Jan 30Pushed 4mo agoCompare

[ Source](https://github.com/digitalmanagerguru/laravel-pubsub-queue)[ Packagist](https://packagist.org/packages/digitalmanagerguru/laravel-pubsub-queue)[ RSS](/packages/digitalmanagerguru-laravel-pubsub-queue/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (7)Dependencies (15)Versions (8)Used By (0)

Laravel PubSub Queue
====================

[](#laravel-pubsub-queue)

[![GitHub tag](https://camo.githubusercontent.com/3929396651d4b9082146efc5609a24387807fc14b158c0debb5312a90b65e060/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f7461672f6469676974616c6d616e61676572677572752f6c61726176656c2d7075627375622d71756575653f696e636c7564655f70726572656c65617365733d26736f72743d73656d76657226636f6c6f723d626c7565)](https://github.com/digitalmanagerguru/laravel-pubsub-queue/releases/)[![License](https://camo.githubusercontent.com/d6bc2b26794002c24d023acaab01b6dbb953c57ab9cb80ba5b8aa2f2bd5de99a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d626c7565)](#license)[![issues - laravel-pubsub-queue](https://camo.githubusercontent.com/b1062b886e06289632ce390c77bf48326c47f4f65bc0d4c6c178af635e99911c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f6469676974616c6d616e61676572677572752f6c61726176656c2d7075627375622d7175657565)](https://github.com/digitalmanagerguru/laravel-pubsub-queue/issues)

This package is a Laravel queue driver that uses the [Google Cloud Pub/Sub](https://github.com/googleapis/google-cloud-php-pubsub) service.

Installation
------------

[](#installation)

Install with [Composer](https://getcomposer.org):

```
composer require digitalmanagerguru/laravel-pubsub-queue
```

If you disabled package discovery, register the provider manually in the `providers` array of `config/app.php`:

```
Digitalmanagerguru\PubSubQueue\PubSubQueueServiceProvider::class,
```

Configuration
-------------

[](#configuration)

Add a `pubsub` connection to `config/queue.php`. Any option accepted by the underlying [Google Cloud Pub/Sub client](https://cloud.google.com/php/docs/reference/cloud-pubsub/latest/PubSubClient)can be passed here (use `snake_case` keys — they are converted to `camelCase` before reaching the client).

```
'pubsub' => [
    'driver' => 'pubsub',
    'queue' => env('PUBSUB_QUEUE', 'default'),
    'queue_prefix' => env('PUBSUB_QUEUE_PREFIX', ''),
    'project_id' => env('PUBSUB_PROJECT_ID', 'your-project-id'),
    'keyFilePath' => env('PUBSUB_KEY_FILE'),           // path to the service-account JSON (optional; ADC used if omitted)
    'retrySettings' => [
        'maxRetries' => 3,
    ],
    'request_timeout' => env('PUBSUB_REQUEST_TIMEOUT', 60),
    'subscriber' => env('PUBSUB_SUBSCRIBER', 'subscriber-name'),
    'create_topics' => env('PUBSUB_CREATE_TOPICS', true),
    'create_subscriptions' => env('PUBSUB_CREATE_SUBSCRIPTIONS', true),
    'return_immediately' => env('PUBSUB_RETURN_IMMEDIATELY', false),
    'max_messages' => env('PUBSUB_MAX_MESSAGES', 1),
],
```

### Options

[](#options)

KeyDefaultDescription`queue``default`Default queue (Pub/Sub **topic**) name.`queue_prefix``''`Prefix prepended to every topic/queue name (e.g. `myapp-`).`project_id`—Google Cloud project id.`keyFilePath`—Path to the service-account JSON. If omitted, Application Default Credentials are used.`subscriber``subscriber`The **subscription** name used to consume. One worker deployment = one subscription.`create_topics``true`Auto-create the topic if missing. Set `false` in production to avoid admin-operation limits.`create_subscriptions``true`Auto-create the subscription if missing. Set `false` in production.`retrySettings``maxRetries: 3`Passed through to the Pub/Sub client.`request_timeout``60`Per-RPC timeout (seconds). Also bounds how long a long-poll `pull` blocks — see [Long-polling](#long-polling-return_immediately).`return_immediately``false`Pull mode — see [Long-polling](#long-polling-return_immediately).`max_messages``1`Messages fetched per pull — see [Batching](#batching-max_messages).How it works
------------

[](#how-it-works)

### Delivery semantics — at-most-once

[](#delivery-semantics--at-most-once)

`pop()` **acknowledges each message as soon as it is pulled** (before the job runs). This gives **at-most-once** delivery: if a worker crashes mid-processing, the in-flight (and any buffered) messages are *not* redelivered. This trades the (rare) lost message for never double-processing — suitable for idempotent / externally-deduplicated work (e.g. analytics pixels, webhooks with their own dedup). If you need at-least-once, do not use this driver as-is.

### Batching (`max_messages`)

[](#batching-max_messages)

Each empty-buffer `pop()` issues **one** `pull` for up to `max_messages` messages, acknowledges the whole batch in a single `acknowledgeBatch` call, buffers them in memory, and serves them to the worker one at a time. Subsequent `pop()` calls drain the buffer without hitting the API.

- `max_messages = 1` (default) — one message per pull; behaviour identical to fetching singly.
- `max_messages > 1` — fewer pull/ack round-trips per message. This is the recommended setting for high-throughput, short-lived jobs: the cheaper, batched acknowledgements land well within the subscription's ack deadline, which **avoids ack-deadline expiry and the redelivery it causes**.

Because of at-most-once semantics, a crash can lose up to `max_messages` buffered messages, so keep the value modest (e.g. `5`–`20`).

### Long-polling (`return_immediately`)

[](#long-polling-return_immediately)

- `false` (default, **recommended**) — the `pull` **long-polls**: it blocks until at least one message is available (or `request_timeout` elapses) and returns backlog messages promptly.
- `true` — the `pull` returns immediately; it may return an empty response *even when the backlog is non-empty*, leaving messages waiting and inflating latency. Avoid for worker consumption.

When long-polling, an idle `pop()` blocks for up to `request_timeout` seconds. Keep `request_timeout`**below** your worker's shutdown grace period (e.g. Kubernetes `terminationGracePeriodSeconds`) so a `SIGTERM` during a deploy is honoured promptly instead of being `SIGKILL`ed.

### Delayed jobs

[](#delayed-jobs)

Jobs dispatched with a delay (`later()` / released with a backoff) carry a future `available_at`attribute. Such messages are pulled but **not** acknowledged until they are due, so Pub/Sub redelivers them at the right time. Delayed messages are excluded from a batch (only currently-due messages are acknowledged and buffered).

### Message ordering

[](#message-ordering)

Ordering keys set on a job (`$job->orderingKey`) are forwarded on publish. Enabling ordered delivery also requires enabling message ordering on the subscription. Note that ordering does not change the at-least-once nature of Pub/Sub and can increase head-of-line latency.

Avoiding administrator-operation limits
---------------------------------------

[](#avoiding-administrator-operation-limits)

In production, set `create_topics` and `create_subscriptions` to `false` (create the topic and subscription ahead of time via IaC / `gcloud`) to avoid hitting Pub/Sub admin-operation quotas on every boot.

Testing
-------

[](#testing)

```
vendor/bin/phpunit
```

License
-------

[](#license)

This project is licensed under the terms of the MIT license. See [License File](LICENSE) for more information.

###  Health Score

46

—

FairBetter than 92% of packages

Maintenance84

Actively maintained with recent releases

Popularity24

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 56.9% 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 ~89 days

Recently: every ~26 days

Total

7

Last Release

29d ago

Major Versions

1.0.0 → 2.0.02025-02-26

2.0.0 → 3.0.02026-04-07

### Community

Maintainers

![](https://www.gravatar.com/avatar/83672fbc6b14f467ab53f557471717ff3929b0dfa01b4bc37ec42a769da0e068?d=identicon)[RicardoRodriguesGuru](/maintainers/RicardoRodriguesGuru)

---

Top Contributors

[![kainxspirits](https://avatars.githubusercontent.com/u/5594710?v=4)](https://github.com/kainxspirits "kainxspirits (37 commits)")[![RicardoRodriguesGuru](https://avatars.githubusercontent.com/u/57721219?v=4)](https://github.com/RicardoRodriguesGuru "RicardoRodriguesGuru (10 commits)")[![MRGAO-CR7](https://avatars.githubusercontent.com/u/22876157?v=4)](https://github.com/MRGAO-CR7 "MRGAO-CR7 (3 commits)")[![Jeckerson](https://avatars.githubusercontent.com/u/3289702?v=4)](https://github.com/Jeckerson "Jeckerson (2 commits)")[![laravel-shift](https://avatars.githubusercontent.com/u/15991828?v=4)](https://github.com/laravel-shift "laravel-shift (2 commits)")[![developerdino](https://avatars.githubusercontent.com/u/747501?v=4)](https://github.com/developerdino "developerdino (1 commits)")[![garbetjie](https://avatars.githubusercontent.com/u/254752?v=4)](https://github.com/garbetjie "garbetjie (1 commits)")[![goodevilgenius](https://avatars.githubusercontent.com/u/254662?v=4)](https://github.com/goodevilgenius "goodevilgenius (1 commits)")[![phroggyy](https://avatars.githubusercontent.com/u/7256451?v=4)](https://github.com/phroggyy "phroggyy (1 commits)")[![richan-fongdasen](https://avatars.githubusercontent.com/u/5222595?v=4)](https://github.com/richan-fongdasen "richan-fongdasen (1 commits)")[![aliozkan](https://avatars.githubusercontent.com/u/936116?v=4)](https://github.com/aliozkan "aliozkan (1 commits)")[![v8-ict](https://avatars.githubusercontent.com/u/29880593?v=4)](https://github.com/v8-ict "v8-ict (1 commits)")[![andreladocruz](https://avatars.githubusercontent.com/u/3315596?v=4)](https://github.com/andreladocruz "andreladocruz (1 commits)")[![andvla](https://avatars.githubusercontent.com/u/12616998?v=4)](https://github.com/andvla "andvla (1 commits)")[![CasperLaiTW](https://avatars.githubusercontent.com/u/5094008?v=4)](https://github.com/CasperLaiTW "CasperLaiTW (1 commits)")[![danny-dtcmedia](https://avatars.githubusercontent.com/u/72079777?v=4)](https://github.com/danny-dtcmedia "danny-dtcmedia (1 commits)")

---

Tags

laravelgooglequeuepubsubgcpkainxspiritsdigitalmanagerguru

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/digitalmanagerguru-laravel-pubsub-queue/health.svg)

```
[![Health](https://phpackages.com/badges/digitalmanagerguru-laravel-pubsub-queue/health.svg)](https://phpackages.com/packages/digitalmanagerguru-laravel-pubsub-queue)
```

###  Alternatives

[laravel/horizon

Dashboard and code-driven configuration for Laravel queues.

4.2k99.8M355](/packages/laravel-horizon)[kainxspirits/laravel-pubsub-queue

Queue driver for Google Cloud Pub/Sub.

48426.5k3](/packages/kainxspirits-laravel-pubsub-queue)[illuminate/queue

The Illuminate Queue package.

20433.0M1.8k](/packages/illuminate-queue)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9922.4M146](/packages/roots-acorn)[harris21/laravel-fuse

Circuit breaker for Laravel queue jobs. Protect your workers from cascading failures.

46273.9k](/packages/harris21-laravel-fuse)[fomvasss/laravel-ai-tasks

AI task orchestrator for Laravel: routing, queue, audit, budget, webhooks

381.6k1](/packages/fomvasss-laravel-ai-tasks)

PHPackages © 2026

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