PHPackages                             offload-project/laravel-google-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. [Queues &amp; Workers](/categories/queues)
4. /
5. offload-project/laravel-google-pubsub

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

offload-project/laravel-google-pubsub
=====================================

Google Cloud Pub/Sub for Laravel with full feature support

v1.3.0(2w ago)817921MITPHPPHP ^8.3CI passing

Since Dec 16Pushed 2w agoCompare

[ Source](https://github.com/offload-project/laravel-google-pubsub)[ Packagist](https://packagist.org/packages/offload-project/laravel-google-pubsub)[ Docs](https://github.com/offload-project/laravel-google-pubsub)[ RSS](/packages/offload-project-laravel-google-pubsub/feed)WikiDiscussions main Synced today

READMEChangelog (7)Dependencies (32)Versions (10)Used By (1)

Laravel Google Pub/Sub
======================

[](#laravel-google-pubsub)

[![Latest Version on Packagist](https://camo.githubusercontent.com/60e2626742aecfd9251f26f80f8c1a18a56b386ebf5305d61144b0ec663432a6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6f66666c6f61642d70726f6a6563742f6c61726176656c2d676f6f676c652d7075627375622e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/offload-project/laravel-google-pubsub)[![Tests](https://camo.githubusercontent.com/d3bcf773892cda294f307ef17cdc5f62776284d2e88bd87381ae3b2eb7bfea9c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6f66666c6f61642d70726f6a6563742f6c61726176656c2d676f6f676c652d7075627375622f74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/offload-project/laravel-google-pubsub/actions/workflows/tests.yml)[![Build](https://camo.githubusercontent.com/4e29c35cf89e116b615cecf21b2f6563292d2d14fe838abd679c9c5064b73a5c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6f66666c6f61642d70726f6a6563742f6c61726176656c2d676f6f676c652d7075627375622f72656c656173652e796d6c3f6c6162656c3d6275696c64267374796c653d666c61742d737175617265)](https://github.com/offload-project/laravel-google-pubsub/actions/workflows/release.yml)[![Total Downloads](https://camo.githubusercontent.com/55ad58374e802a3aa93d53f59032ea926bf5a9f703a46e7d4ad55fdf884b945a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6f66666c6f61642d70726f6a6563742f6c61726176656c2d676f6f676c652d7075627375622e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/offload-project/laravel-google-pubsub)[![License: MIT](https://camo.githubusercontent.com/6c711032aff1ca0eb6b211aa6cb3649ce7fd64a7714e1181d4bb457f9680e7cf/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)

A comprehensive Google Cloud Pub/Sub integration for Laravel that goes beyond a basic queue driver — a complete toolkit for event-driven architectures, microservice communication, and real-time data pipelines.

Features
--------

[](#features)

- **Full Laravel queue driver** — drop-in replacement for any other queue connection
- **Publisher / Subscriber services** — direct publishing with compression, metadata, and batch support
- **Event integration** — bidirectional flow between Laravel events and Pub/Sub topics
- **Webhook support** — handle push subscriptions with built-in IP allowlist and token verification
- **Schema validation** — JSON Schema validation for message contracts
- **Streaming support** — real-time, lower-latency processing with StreamingPull
- **CloudEvents support** — industry-standard event formatting with v1.0 compatibility
- **Dead-letter topics &amp; retry policies** — auto-wired for resilient message delivery
- **Emulator support** — local development with the Google Cloud Pub/Sub emulator
- **Laravel Octane compatible** — connection pooling and warm bindings
- **Rich Artisan command set** — manage topics, subscriptions, publishing, and listening from the CLI

Table of Contents
-----------------

[](#table-of-contents)

- [Requirements](#requirements)
- [Installation](#installation)
- [Quick Start](#quick-start)
    - [Basic Queue Usage](#1-basic-queue-usage)
    - [Direct Publishing](#2-direct-publishing)
    - [Event Integration](#3-event-integration)
    - [Subscribing to Messages](#4-subscribing-to-messages)
- [Full Documentation](#full-documentation)
- [AI Coding Assistant Skill](#ai-coding-assistant-skill)
- [Testing](#testing)
- [Contributing](#contributing)
- [Security](#security)
- [License](#license)

Requirements
------------

[](#requirements)

- PHP 8.3+
- Laravel 11 / 12 / 13
- A Google Cloud project with the Pub/Sub API enabled (or the [Pub/Sub emulator](https://cloud.google.com/pubsub/docs/emulator) for local development)

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

[](#installation)

```
composer require offload-project/laravel-google-pubsub

php artisan vendor:publish --provider="OffloadProject\GooglePubSub\PubSubServiceProvider" --tag="config"
```

Add the basics to your `.env`:

```
QUEUE_CONNECTION=pubsub
GOOGLE_CLOUD_PROJECT_ID=your-project-id

# Authentication — pick one
PUBSUB_AUTH_METHOD=application_default
# or
PUBSUB_AUTH_METHOD=key_file
GOOGLE_APPLICATION_CREDENTIALS=/path/to/service-account.json
```

Then add a `pubsub` connection to `config/queue.php`:

```
'connections' => [
    'pubsub' => [
        'driver' => 'pubsub',
        'project_id' => env('GOOGLE_CLOUD_PROJECT_ID'),
        'queue' => env('PUBSUB_DEFAULT_QUEUE', 'default'),
        'auth_method' => env('PUBSUB_AUTH_METHOD', 'application_default'),
        'key_file' => env('GOOGLE_APPLICATION_CREDENTIALS'),
        'auto_create_topics' => true,
        'auto_create_subscriptions' => true,
        'subscription_suffix' => '-laravel',
        'enable_message_ordering' => false,
    ],
],
```

See the [Configuration reference](docs/implementation/configuration.md) for every option.

Quick Start
-----------

[](#quick-start)

### 1. Basic Queue Usage

[](#1-basic-queue-usage)

Use it exactly like any other Laravel queue:

```
ProcessPodcast::dispatch($podcast);

// Dispatch to a specific topic
ProcessPodcast::dispatch($podcast)->onQueue('audio-processing');
```

### 2. Direct Publishing

[](#2-direct-publishing)

```
use OffloadProject\GooglePubSub\Facades\PubSub;

PubSub::publish('orders', [
    'order_id' => 123,
    'total' => 99.99,
    'customer_id' => 456,
]);

// With attributes and an ordering key
PubSub::publish('orders', $data, [
    'priority' => 'high',
    'source' => 'api',
], [
    'ordering_key' => 'customer-456',
]);
```

### 3. Event Integration

[](#3-event-integration)

```
use OffloadProject\GooglePubSub\Attributes\PublishTo;
use OffloadProject\GooglePubSub\Contracts\ShouldPublishToPubSub;

#[PublishTo('orders')]
class OrderPlaced implements ShouldPublishToPubSub
{
    public function __construct(public Order $order) {}

    public function pubsubTopic(): string
    {
        return 'orders';
    }

    public function toPubSub(): array
    {
        return [
            'order_id' => $this->order->id,
            'total' => $this->order->total,
            'customer_id' => $this->order->customer_id,
        ];
    }
}

event(new OrderPlaced($order));
```

### 4. Subscribing to Messages

[](#4-subscribing-to-messages)

```
use OffloadProject\GooglePubSub\Facades\PubSub;

$subscriber = PubSub::subscribe('orders-processor', 'orders');

$subscriber->handler(function ($data, $message) {
    processOrder($data);
});

$subscriber->listen();
```

Full Documentation
------------------

[](#full-documentation)

- **[Installation](docs/implementation/installation.md)**
- **[Configuration](docs/implementation/configuration.md)** — every config key, with defaults
- **[Queue Driver](docs/queue-driver.md)**
- **[Publisher &amp; Subscriber](docs/direct-pubsub.md)**
- **[Event Integration](docs/event-integration.md)**
- **[Webhooks (Push Subscriptions)](docs/webhook-push.md)**
- **[Message Schemas and Validation](docs/messages/message-schemas.md)**
- **[CloudEvents](docs/messages/cloudevents.md)**
- **[Artisan Commands](docs/artisan-commands.md)**
- **[Monitoring &amp; Debugging](docs/reference/monitoring-debugging.md)** — performance tuning and troubleshooting
- **[Testing](docs/reference/testing.md)**
- **[Examples](docs/reference/examples.md)**

AI Coding Assistant Skill
-------------------------

[](#ai-coding-assistant-skill)

This package ships a [Laravel Boost](https://skills.laravel.cloud/) skill so coding assistants (Claude Code, Cursor, etc.) follow the package's conventions when generating code. Install it in your app with:

```
php artisan boost:add-skill offload-project/laravel-google-pubsub
```

The skill source lives at [`skills/SKILL.md`](skills/SKILL.md).

Testing
-------

[](#testing)

```
composer test
```

Contributing
------------

[](#contributing)

Contributions are welcome! Please see the documents below before getting started.

- [Contributing Guide](CONTRIBUTING.md) — setup, workflow, commit conventions, and PR process
- [Code of Conduct](CODE_OF_CONDUCT.md) — expectations for participation in this project

Security
--------

[](#security)

- [Security Policy](SECURITY.md) — how to report a vulnerability privately

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

47

—

FairBetter than 93% of packages

Maintenance90

Actively maintained with recent releases

Popularity21

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 70% 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 ~36 days

Recently: every ~19 days

Total

6

Last Release

18d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/331bcc01f75f46dded875d74f3db055da6d74be5f8820f0a29105c6a2cd8afc8?d=identicon)[shavonn](/maintainers/shavonn)

---

Top Contributors

[![shavonn](https://avatars.githubusercontent.com/u/3074595?v=4)](https://github.com/shavonn "shavonn (21 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (6 commits)")[![alikemalcivelek](https://avatars.githubusercontent.com/u/20399827?v=4)](https://github.com/alikemalcivelek "alikemalcivelek (2 commits)")[![zehmoreira](https://avatars.githubusercontent.com/u/30963002?v=4)](https://github.com/zehmoreira "zehmoreira (1 commits)")

---

Tags

laravelcloudgooglequeuepubsubgcp

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/offload-project-laravel-google-pubsub/health.svg)

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

###  Alternatives

[laravel/horizon

Dashboard and code-driven configuration for Laravel queues.

4.2k95.4M305](/packages/laravel-horizon)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k15.1M131](/packages/laravel-pulse)[laravel/ai

The official AI SDK for Laravel.

1.0k3.2M194](/packages/laravel-ai)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9762.4M131](/packages/roots-acorn)[kainxspirits/laravel-pubsub-queue

Queue driver for Google Cloud Pub/Sub.

48414.4k3](/packages/kainxspirits-laravel-pubsub-queue)[nuwber/rabbitevents

The Nuwber RabbitEvents package

122529.7k4](/packages/nuwber-rabbitevents)

PHPackages © 2026

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