# Cloud Storage Client - Class Notification (2.3.0)

2.3.0 (latest) 2.2.0 2.1.0 2.0.0 1.51.0 1.50.0 1.49.2 1.48.7 1.47.0 1.46.0 1.45.0 1.44.0 1.43.1 1.42.1 1.41.4 1.37.0 1.36.1 1.35.0 1.34.0 1.33.4 1.32.0 1.31.2 1.30.3

> [!WARNING]
> **Beta**
>
>
> This library is covered by the [Pre-GA Offerings Terms](https://docs.cloud.google.com/terms/service-terms#1)
> of the Terms of Service. Pre-GA libraries might have limited support,
> and changes to pre-GA libraries might not be compatible with other pre-GA versions.
> For more information, see the
> [launch stage descriptions](https://docs.cloud.google.com/products#product-launch-stages).

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 on [Bucket](https://docs.cloud.google.com/php/docs/reference/cloud-storage/latest/Bucket).

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!';
    }

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `options` | `array` Configuration options. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `bool` |   |

### delete

See also:

- [Notifications delete API documentation.](https://cloud.google.com/storage/docs/json_api/v1/notifications/delete)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `options` | `array` \[optional\] |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `void` |   |

### info

See also:

- [Notifications get API documentation.](https://cloud.google.com/storage/docs/json_api/v1/notifications/get)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `options` | `array` \[optional\] |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `array` |   |

### reload

See also:

- [Notifications get API documentation.](https://cloud.google.com/storage/docs/json_api/v1/notifications/get)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `options` | `array` \[optional\] |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `array` |   |

### id

Retrieves the notification's ID.

Example:

    echo $notification->id();

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### identity

Retrieves the notification's identity.

Example:

    echo $notification->identity()['bucket'];

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `array` |   |