google / cloud-pubsub
Cloud PubSub Client for PHP
Requires
- php: ^8.0
- google/cloud-core: ^1.57
- google/gax: ^1.36.0
Requires (Dev)
- erusev/parsedown: ^1.6
- flix-tech/avro-php: ^5.0.0
- phpdocumentor/reflection: ^5.3.3||^6.0
- phpdocumentor/reflection-docblock: ^5.3
- phpspec/prophecy-phpunit: ^2.0
- phpunit/phpunit: ^9.0
- squizlabs/php_codesniffer: 2.*
Suggests
- ext-grpc: The gRPC extension enables use of the performant gRPC transport
- ext-protobuf: Provides a significant increase in throughput over the pure PHP protobuf implementation. See https://cloud.google.com/php/grpc for installation instructions.
- dev-main
- v2.8.2
- v2.8.1
- v2.8.0
- v2.7.0
- v2.6.0
- v2.5.2
- v2.5.1
- v2.5.0
- v2.4.0
- v2.3.0
- v2.2.1
- v2.2.0
- v2.1.2
- v2.1.1
- v2.1.0
- v2.0.0
- v2.0.0-RC1
- v1.51.0
- v1.50.0
- v1.49.0
- v1.48.0
- v1.47.0
- v1.46.4
- v1.46.3
- v1.46.2
- v1.46.1
- v1.46.0
- v1.45.2
- v1.45.1
- v1.45.0
- v1.44.0
- v1.43.2
- v1.43.1
- v1.43.0
- v1.42.1
- v1.42.0
- v1.41.3
- v1.41.2
- v1.41.1
- v1.41.0
- v1.40.1
- v1.40.0
- v1.39.3
- v1.39.2
- v1.39.1
- v1.39.0
- v1.38.4
- v1.38.3
- v1.38.2
- v1.38.1
- v1.38.0
- v1.37.0
- v1.36.1
- v1.36.0
- v1.35.1
- v1.35.0
- v1.34.3
- v1.34.2
- v1.34.1
- v1.34.0
- v1.33.0
- v1.32.0
- v1.31.1
- v1.31.0
- v1.30.3
- v1.30.2
- v1.30.1
- v1.30.0
- v1.29.4
- v1.29.3
- v1.29.2
- v1.29.1
- v1.29.0
- v1.28.0
- v1.27.0
- v1.26.0
- v1.25.0
- v1.24.1
- v1.24.0
- v1.23.0
- v1.22.0
- v1.21.1
- v1.21.0
- v1.20.0
- v1.19.0
- v1.18.0
- v1.17.0
- v1.16.0
- v1.15.0
- v1.14.0
- v1.13.0
- v1.12.2
- v1.12.1
- v1.12.0
- v1.11.2
- v1.11.1
- v1.11.0
- v1.10.0
- v1.9.0
- v1.8.2
- v1.8.1
- v1.8.0
- v1.7.2
- v1.7.1
- v1.7.0
- v1.6.0
- v1.5.1
- v1.5.0
- v1.4.4
- v1.4.3
- v1.4.2
- v1.4.1
- v1.4.0
- v1.3.0
- v1.2.1
- v1.2.0
- v1.1.4
- v1.1.3
- v1.1.2
- v1.1.1
- v1.1.0
- v1.0.2
- v1.0.1
- v1.0.0
- v0.12.2
- v0.12.1
- v0.12.0
- v0.11.3
- v0.11.2
- v0.11.1
- v0.11.0
- v0.10.0
- v0.9.2
- v0.9.1
- v0.9.0
- v0.8.0
- v0.7.0
- v0.6.2
- v0.6.1
- v0.6.0
- v0.5.1
- v0.5.0
- v0.4.0
- v0.3.0
- v0.2.0
- v0.1.0
This package is auto-updated.
Last update: 2024-12-12 23:16:11 UTC
README
Idiomatic PHP client for Cloud Pub/Sub.
NOTE: This repository is part of 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
To begin, install the preferred dependency manager for PHP, Composer.
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.
Authentication
Please see our Authentication guide for more information on authenticating your client. Once authenticated, you'll be ready to start making requests.
Sample
require 'vendor/autoload.php'; use Google\Cloud\PubSub\PubSubClient; $pubSub = new PubSubClient(); // Get an instance of a previously created topic. $topic = $pubSub->topic('my_topic'); // Publish a message to the topic. $topic->publish([ 'data' => 'My new message.', 'attributes' => [ 'location' => 'Detroit' ] ]); // Get an instance of a previously created subscription. $subscription = $pubSub->subscription('my_subscription'); // Pull all available messages. $messages = $subscription->pull(); foreach ($messages as $message) { echo $message->data() . "\n"; echo $message->attribute('location'); }
Debugging
Please see our Debugging guide for more information about the debugging tools.
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 to upgrade from V1 of the library to V2.
Next Steps
- Understand the official documentation.
- Take a look at in-depth usage samples.