Reference documentation and code samples for the Cloud Storage Client class Notification.
Cloud Pub/Sub Notifications sends information about changes to objects in
your buckets to Google Cloud Pub/Sub, where the information is added to a
Cloud Pub/Sub topic of your choice in the form of messages. For example,
you can track objects that are created and deleted in your bucket. Each
notification contains information describing both the event that triggered it
and the object that changed.
To utilize this class and see more examples, please see the relevant
notifications based methods exposed onBucket.
Example:
use Google\Cloud\Storage\StorageClient;
$storage = new StorageClient();
// Fetch an existing notification by ID.
$bucket = $storage->bucket('my-bucket');
$notification = $bucket->notification('2482');
Namespace
Google \ Cloud \ Storage
Methods
__construct
Parameters
Name
Description
connection
Connection\ConnectionInterface
Represents a connection to Cloud
Storage. This object is created by StorageClient,
and should not be instantiated outside of this client.
id
string
The notification's ID.
bucket
string
The name of the bucket associated with this
notification.
info
array
[optional] The notification's metadata.
exists
Check whether or not the notification exists.
Example:
if ($notification->exists()) {
echo 'Notification exists!';
}
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,["# Cloud Storage Client - Class Notification (1.48.3)\n\nVersion latestkeyboard_arrow_down\n\n- [1.48.3 (latest)](/php/docs/reference/cloud-storage/latest/Notification)\n- [1.48.2](/php/docs/reference/cloud-storage/1.48.2/Notification)\n- [1.47.0](/php/docs/reference/cloud-storage/1.47.0/Notification)\n- [1.46.0](/php/docs/reference/cloud-storage/1.46.0/Notification)\n- [1.45.0](/php/docs/reference/cloud-storage/1.45.0/Notification)\n- [1.44.0](/php/docs/reference/cloud-storage/1.44.0/Notification)\n- [1.43.1](/php/docs/reference/cloud-storage/1.43.1/Notification)\n- [1.42.1](/php/docs/reference/cloud-storage/1.42.1/Notification)\n- [1.41.4](/php/docs/reference/cloud-storage/1.41.4/Notification)\n- [1.37.0](/php/docs/reference/cloud-storage/1.37.0/Notification)\n- [1.36.1](/php/docs/reference/cloud-storage/1.36.1/Notification)\n- [1.35.0](/php/docs/reference/cloud-storage/1.35.0/Notification)\n- [1.34.0](/php/docs/reference/cloud-storage/1.34.0/Notification)\n- [1.33.4](/php/docs/reference/cloud-storage/1.33.4/Notification)\n- [1.32.0](/php/docs/reference/cloud-storage/1.32.0/Notification)\n- [1.31.2](/php/docs/reference/cloud-storage/1.31.2/Notification)\n- [1.30.3](/php/docs/reference/cloud-storage/1.30.3/Notification) \n| **Beta**\n|\n|\n| This library is covered by the [Pre-GA Offerings Terms](/terms/service-terms#1)\n| of the Terms of Service. Pre-GA libraries might have limited support,\n| and changes to pre-GA libraries might not be compatible with other pre-GA versions.\n| For more information, see the\n[launch stage descriptions](/products#product-launch-stages). \nReference documentation and code samples for the Cloud Storage Client class Notification.\n\nCloud Pub/Sub Notifications sends information about changes to objects in\nyour buckets to Google Cloud Pub/Sub, where the information is added to a\nCloud Pub/Sub topic of your choice in the form of messages. For example,\nyou can track objects that are created and deleted in your bucket. Each\nnotification contains information describing both the event that triggered it\nand the object that changed.\n\nTo utilize this class and see more examples, please see the relevant\nnotifications based methods exposed on [Bucket](/php/docs/reference/cloud-storage/latest/Bucket).\n\nExample: \n\n use Google\\Cloud\\Storage\\StorageClient;\n\n $storage = new StorageClient();\n\n // Fetch an existing notification by ID.\n $bucket = $storage-\u003ebucket('my-bucket');\n $notification = $bucket-\u003enotification('2482');\n\nNamespace\n---------\n\nGoogle \\\\ Cloud \\\\ Storage\n\nMethods\n-------\n\n### __construct\n\n### exists\n\nCheck whether or not the notification exists.\n\nExample: \n\n if ($notification-\u003eexists()) {\n echo 'Notification exists!';\n }\n\n### delete\n\nSee also:\n\n- [Notifications delete API documentation.](https://cloud.google.com/storage/docs/json_api/v1/notifications/delete)\n\n### info\n\nSee also:\n\n- [Notifications get API documentation.](https://cloud.google.com/storage/docs/json_api/v1/notifications/get)\n\n### reload\n\nSee also:\n\n- [Notifications get API documentation.](https://cloud.google.com/storage/docs/json_api/v1/notifications/get)\n\n### id\n\nRetrieves the notification's ID.\n\nExample: \n\n echo $notification-\u003eid();\n\n### identity\n\nRetrieves the notification's identity.\n\nExample: \n\n echo $notification-\u003eidentity()['bucket'];"]]