Download the PHP package shyam-achuthan/google-cloud without Composer
On this page you can find all versions of the php package shyam-achuthan/google-cloud. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download shyam-achuthan/google-cloud
More information about shyam-achuthan/google-cloud
Files in shyam-achuthan/google-cloud
Download shyam-achuthan/google-cloud
More information about shyam-achuthan/google-cloud
Files in shyam-achuthan/google-cloud
Vendor shyam-achuthan
Package google-cloud
Short Description A library for easy access of google cloud platform - PubSub ( Alternative to Amazon SQS )
License MIT
Package google-cloud
Short Description A library for easy access of google cloud platform - PubSub ( Alternative to Amazon SQS )
License MIT
Please rate this library. Is it a good library?
Informations about the package google-cloud
GoogleCloud
An easy to use platform for google pubsub on php
composer require shyam-achuthan/google-cloud
Initializing the library
$projectId = "<your-google-project-id>";
$key_file_location = "<path-to-service-account-json-credentials";
$pubsub = new \GoogleCloud\Pubsub($projectId,$key_file_location);
$pubsub->setTopic("<your-message-topic>");
$pubsub->setSubscription("<your-pull-subscription-name>");
Sending a message to the queue
$data = ["name"=>"Shyam",'email'=>"[email protected]" ]; // string key value pair data to pass to the queue receiver
$message = "SEND_USER_WELCOME_EMAIL"; // any text message here am using this string to differentiate the actions on the receiver side
$response = $pubsub->sendMessage($message,$data);
$resp = $response;
Receiving queue messages
$resp = $pubsub->receiveMessages();
will return Array of message objects which has three attributes
- message_title - [String] the message passed to send message while sending
- data - [Array] array of data ( key value pair as passed in sending message )
- handle - [String] unique identifier of the message, the acknoledgement-id which is used to delete the message
Delete a message
$response = $pubsub->deleteMessage($message->handle);
Receive message do execution and delete message
$resp = $pubsub->receiveMessages();
foreach($resp as $message){
// Do what ever executin needed with $message->message_title, $message->data
$pubsub->deleteMessage($message->handle);
}
Delete multiple messages together
$pubsub->deleteMessage($handles); // where handles is array of handle/acknowledgement-ids
All versions of google-cloud with dependencies
PHP Build Version
Package Version
Requires
google/apiclient Version
^2.0.0@RC
The package shyam-achuthan/google-cloud contains the following files
Loading the files please wait ....