PHPackages                             google/cloud-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. google/cloud-pubsub

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

google/cloud-pubsub
===================

Cloud PubSub Client for PHP

v2.19.1(2mo ago)9017.1M—0.2%24[2 PRs](https://github.com/googleapis/google-cloud-php-pubsub/pulls)20Apache-2.0PHPPHP ^8.1CI passing

Since Mar 10Pushed 2mo ago50 watchersCompare

[ Source](https://github.com/googleapis/google-cloud-php-pubsub)[ Packagist](https://packagist.org/packages/google/cloud-pubsub)[ RSS](/packages/google-cloud-pubsub/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (18)Versions (168)Used By (20)

Google Cloud PubSub for PHP
===========================

[](#google-cloud-pubsub-for-php)

> Idiomatic PHP client for [Cloud Pub/Sub](https://cloud.google.com/pubsub/).

[![Latest Stable Version](https://camo.githubusercontent.com/8de8e2f0eb19ab3137d3fe89bb90ac260d466bd8ad48256d21e57a718a66e315/68747470733a2f2f706f7365722e707567782e6f72672f676f6f676c652f636c6f75642d7075627375622f762f737461626c65)](https://packagist.org/packages/google/cloud-pubsub) [![Packagist](https://camo.githubusercontent.com/f35877b865fed3ce13eee55c2284d1238657ada78cbe9f120e33f8c76104017c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f676f6f676c652f636c6f75642d7075627375622e737667)](https://packagist.org/packages/google/cloud-pubsub)

- [API documentation](https://cloud.google.com/php/docs/reference/cloud-pubsub/latest)

**NOTE:** This repository is part of [Google Cloud PHP](https://github.com/googleapis/google-cloud-php). Any support requests, bug reports, or development contributions should be directed to that project.

A fully-managed real-time messaging service that allows you to send and receive messages between independent applications.

### Installation

[](#installation)

To begin, install the preferred dependency manager for PHP, [Composer](https://getcomposer.org/).

Now install this component:

```
$ composer require google/cloud-pubsub
```

This component supports both REST over HTTP/1.1 and gRPC. In order to take advantage of the benefits offered by gRPC (such as streaming methods) please see our [gRPC installation guide](https://cloud.google.com/php/grpc).

### Authentication

[](#authentication)

Please see our [Authentication guide](https://github.com/googleapis/google-cloud-php/blob/main/AUTHENTICATION.md) for more information on authenticating your client. Once authenticated, you'll be ready to start making requests.

### Sample

[](#sample)

```
use Google\ApiCore\ApiException;
use Google\Cloud\PubSub\V1\Client\PublisherClient;
use Google\Cloud\PubSub\V1\GetTopicRequest;
use Google\Cloud\PubSub\V1\Topic;

// Create a client.
$publisherClient = new PublisherClient();

// Prepare the request message.
$request = (new GetTopicRequest())
    ->setTopic($formattedTopic);

// Call the API and handle any network failures.
try {
    /** @var Topic $response */
    $response = $publisherClient->getTopic($request);
    printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
    printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
```

### Debugging

[](#debugging)

Please see our [Debugging guide](https://github.com/googleapis/google-cloud-php/blob/main/DEBUG.md)for more information about the debugging tools.

### Version

[](#version)

This component is considered GA (generally available). As such, it will not introduce backwards-incompatible changes in any minor or patch releases. We will address issues and requests with the highest priority.

Please see the [migration guide](./MIGRATING.md) to upgrade from **V1** of the library to **V2**.

### Next Steps

[](#next-steps)

1. Understand the [official documentation](https://cloud.google.com/pubsub/docs/).
2. Take a look at [in-depth usage samples](https://github.com/GoogleCloudPlatform/php-docs-samples/tree/master/pubsub/).

###  Health Score

75

—

ExcellentBetter than 100% of packages

Maintenance87

Actively maintained with recent releases

Popularity63

Solid adoption and visibility

Community47

Growing community involvement

Maturity91

Battle-tested with a long release history

 Bus Factor3

3 contributors hold 50%+ of commits

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 ~19 days

Total

167

Last Release

62d ago

Major Versions

v0.12.2 → v1.0.02018-02-24

v1.51.0 → v2.0.0-RC12024-02-09

PHP version history (3 changes)v1.41.2PHP &gt;=7.4

v2.0.0PHP ^8.0

v2.13.2PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/a8713415b20b4be4cec8f8b22741e3cd05f76eee9e38de1de5bf32727349b7c5?d=identicon)[bshaffer](/maintainers/bshaffer)

![](https://www.gravatar.com/avatar/3901206952845568d7557a60855b097f6d1bafaa7a24020cfcf5bb8de74f9d28?d=identicon)[google-cloud](/maintainers/google-cloud)

---

Top Contributors

[![release-please[bot]](https://avatars.githubusercontent.com/in/40688?v=4)](https://github.com/release-please[bot] "release-please[bot] (93 commits)")[![yoshi-automation](https://avatars.githubusercontent.com/u/44816363?v=4)](https://github.com/yoshi-automation "yoshi-automation (62 commits)")[![gcf-owl-bot[bot]](https://avatars.githubusercontent.com/in/99011?v=4)](https://github.com/gcf-owl-bot[bot] "gcf-owl-bot[bot] (59 commits)")[![jdpedrie](https://avatars.githubusercontent.com/u/89034?v=4)](https://github.com/jdpedrie "jdpedrie (55 commits)")[![bshaffer](https://avatars.githubusercontent.com/u/103941?v=4)](https://github.com/bshaffer "bshaffer (43 commits)")[![dwsupplee](https://avatars.githubusercontent.com/u/2079879?v=4)](https://github.com/dwsupplee "dwsupplee (22 commits)")[![michaelbausor](https://avatars.githubusercontent.com/u/14846209?v=4)](https://github.com/michaelbausor "michaelbausor (12 commits)")[![saranshdhingra](https://avatars.githubusercontent.com/u/1038319?v=4)](https://github.com/saranshdhingra "saranshdhingra (10 commits)")[![vishwarajanand](https://avatars.githubusercontent.com/u/7369612?v=4)](https://github.com/vishwarajanand "vishwarajanand (8 commits)")[![ajupazhamayil](https://avatars.githubusercontent.com/u/14087896?v=4)](https://github.com/ajupazhamayil "ajupazhamayil (5 commits)")[![yash30201](https://avatars.githubusercontent.com/u/54198301?v=4)](https://github.com/yash30201 "yash30201 (3 commits)")[![dpebot](https://avatars.githubusercontent.com/u/19979279?v=4)](https://github.com/dpebot "dpebot (3 commits)")[![danielgsims](https://avatars.githubusercontent.com/u/695933?v=4)](https://github.com/danielgsims "danielgsims (2 commits)")[![WeiranFang](https://avatars.githubusercontent.com/u/8175562?v=4)](https://github.com/WeiranFang "WeiranFang (2 commits)")[![Hectorhammett](https://avatars.githubusercontent.com/u/9062626?v=4)](https://github.com/Hectorhammett "Hectorhammett (2 commits)")[![chingor13](https://avatars.githubusercontent.com/u/32483?v=4)](https://github.com/chingor13 "chingor13 (2 commits)")[![jvdlaar](https://avatars.githubusercontent.com/u/1094732?v=4)](https://github.com/jvdlaar "jvdlaar (2 commits)")[![rpkamp](https://avatars.githubusercontent.com/u/1059790?v=4)](https://github.com/rpkamp "rpkamp (1 commits)")[![taisph](https://avatars.githubusercontent.com/u/814148?v=4)](https://github.com/taisph "taisph (1 commits)")[![vam-google](https://avatars.githubusercontent.com/u/25311427?v=4)](https://github.com/vam-google "vam-google (1 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/google-cloud-pubsub/health.svg)

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

###  Alternatives

[league/geotools

Geo-related tools PHP 7.3+ library

1.4k5.3M26](/packages/league-geotools)[google/cloud-translate

Cloud Translation Client for PHP

20215.9M84](/packages/google-cloud-translate)[amphp/parser

A generator parser to make streaming parsers simple.

14952.8M16](/packages/amphp-parser)[amphp/serialization

Serialization tools for IPC and data storage in PHP.

13451.1M18](/packages/amphp-serialization)[deliciousbrains/wp-background-processing

WP Background Processing can be used to fire off non-blocking asynchronous requests or as a background processing tool, allowing you to queue tasks.

1.1k409.8k6](/packages/deliciousbrains-wp-background-processing)[google/cloud-vision

Cloud Vision Client for PHP

1075.2M24](/packages/google-cloud-vision)

PHPackages © 2026

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