# Cloud Storage Client - Class StorageObject (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 Reference documentation and code samples for the Cloud Storage Client class StorageObject.

Objects are the individual pieces of data that you store in Google Cloud
Storage.

Example:

    use Google\Cloud\Storage\StorageClient;

    $storage = new StorageClient();

    $bucket = $storage->bucket('my-bucket');
    $object = $bucket->object('my-object');

## 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. |
| `name` | `string` The object's name. |
| `bucket` | `string` The name of the bucket the object is contained in. |
| `generation` | `string` \[optional\] The generation of the object. |
| `info` | `array` \[optional\] The object's metadata. |
| `encryptionKey` | `string` \[optional\] An AES-256 customer-supplied encryption key. |
| `encryptionKeySHA256` | `string` \[optional\] The SHA256 hash of the customer-supplied encryption key. |

### acl

See also:

- [More about Access Control Lists](https://cloud.google.com/storage/docs/access-control)

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-storage/latest/Acl` |   |

### exists

Check whether or not the object exists.

Example:

    if ($object->exists()) {
        echo 'Object exists!';
    }

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

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

### delete

See also:

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

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `options` | `array` Configuration options. |
| `↳ ifGenerationMatch` | `string` Makes the operation conditional on whether the object's current generation matches the given value. |
| `↳ ifGenerationNotMatch` | `string` Makes the operation conditional on whether the object's current generation does not match the given value. |
| `↳ ifMetagenerationMatch` | `string` Makes the operation conditional on whether the object's current metageneration matches the given value. |
| `↳ ifMetagenerationNotMatch` | `string` Makes the operation conditional on whether the object's current metageneration does not match the given value. |

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

### update

See also:

- [Objects patch API documentation.](https://cloud.google.com/storage/docs/json_api/v1/objects/patch)

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `metadata` | `array` The available options for metadata are outlined at the [JSON API docs](https://cloud.google.com/storage/docs/json_api/v1/objects#resource) |
| `options` | `array` Configuration options. |
| `↳ ifGenerationMatch` | `string` Makes the operation conditional on whether the object's current generation matches the given value. |
| `↳ ifGenerationNotMatch` | `string` Makes the operation conditional on whether the object's current generation does not match the given value. |
| `↳ ifMetagenerationMatch` | `string` Makes the operation conditional on whether the object's current metageneration matches the given value. |
| `↳ ifMetagenerationNotMatch` | `string` Makes the operation conditional on whether the object's current metageneration does not match the given value. |
| `↳ predefinedAcl` | `string` Predefined ACL to apply to the object. Acceptable values include, `"authenticatedRead"`, `"bucketOwnerFullControl"`, `"bucketOwnerRead"`, `"private"`, `"projectPrivate"`, and `"publicRead"`. |
| `↳ retention` | `array` The full list of available options are outlined at the [JSON API docs](https://cloud.google.com/storage/docs/json_api/v1/objects/update#request-body). | **Properties** || |---|---| | **Name** | **Description** | | `retainUntilTime` | `string` The earliest time in RFC 3339 UTC "Zulu" format that the object can be deleted or replaced. This is the retention configuration set for this object. | | `mode` | `string` The mode of the retention configuration, which can be either `"Unlocked"` or `"Locked"`. | |
| `↳ contexts` | `array` Object contexts. See at the [API docs](https://docs.cloud.google.com/storage/docs/use-object-contexts) for more details. | **Properties** || |---|---| | **Name** | **Description** | | `custom.` | `string` {key}.createTime The time the context was created in RFC 3339 format. **(read only)** | | `custom.` | `string` {key}.updateTime The time the context was last updated in RFC 3339 format. **(read only)** | |
| `↳ overrideUnlockedRetention` | `bool` Applicable for objects that have an unlocked retention configuration. Required to be set to `true` if the operation includes a retention property that changes the mode to `Locked`, reduces the `retainUntilTime`, or removes the retention configuration from the object. |
| `↳ projection` | `string` Determines which properties to return. May be either 'full' or 'noAcl'. |
| `↳ fields` | `string` Selector which will cause the response to only return the specified fields. |

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

### copy

See also:

- [Objects copy API documentation.](https://cloud.google.com/storage/docs/json_api/v1/objects/copy)

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `destination` | `https://docs.cloud.google.com/php/docs/reference/cloud-storage/latest/Bucket|string` The destination bucket. |
| `options` | `array` Configuration options. |
| `↳ name` | `string` The name of the destination object. **Defaults to** the name of the source object. |
| `↳ predefinedAcl` | `string` Predefined ACL to apply to the object. Acceptable values include, `"authenticatedRead"`, `"bucketOwnerFullControl"`, `"bucketOwnerRead"`, `"private"`, `"projectPrivate"`, and `"publicRead"`. |
| `↳ encryptionKey` | `string` A base64 encoded AES-256 customer-supplied encryption key. It will be neccesary to provide this when a key was used during the object's creation. |
| `↳ encryptionKeySHA256` | `string` Base64 encoded SHA256 hash of the customer-supplied encryption key. This value will be calculated from the `encryptionKey` on your behalf if not provided, but for best performance it is recommended to pass in a cached version of the already calculated SHA. |
| `↳ ifGenerationMatch` | `string` Makes the operation conditional on whether the destination object's current generation matches the given value. |
| `↳ ifGenerationNotMatch` | `string` Makes the operation conditional on whether the destination object's current generation does not match the given value. |
| `↳ ifMetagenerationMatch` | `string` Makes the operation conditional on whether the destination object's current metageneration matches the given value. |
| `↳ ifMetagenerationNotMatch` | `string` Makes the operation conditional on whether the destination object's current metageneration does not match the given value. |
| `↳ ifSourceGenerationMatch` | `string` Makes the operation conditional on whether the source object's current generation matches the given value. |
| `↳ ifSourceGenerationNotMatch` | `string` Makes the operation conditional on whether the source object's current generation does not match the given value. |
| `↳ ifSourceMetagenerationMatch` | `string` Makes the operation conditional on whether the source object's current metageneration matches the given value. |
| `↳ ifSourceMetagenerationNotMatch` | `string` Makes the operation conditional on whether the source object's current metageneration does not match the given value. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-storage/latest/StorageObject` |   |

### rewrite

See also:

- [Objects rewrite API documentation.](https://cloud.google.com/storage/docs/json_api/v1/objects/rewrite)
- [Customer-supplied encryption keys.](https://cloud.google.com/storage/docs/encryption#customer-supplied)

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `destination` | `https://docs.cloud.google.com/php/docs/reference/cloud-storage/latest/Bucket|string` The destination bucket. |
| `options` | `array` Configuration options. |
| `↳ name` | `string` The name of the destination object. **Defaults to** the name of the source object. |
| `↳ predefinedAcl` | `string` Predefined ACL to apply to the object. Acceptable values include, `"authenticatedRead"`, `"bucketOwnerFullControl"`, `"bucketOwnerRead"`, `"private"`, `"projectPrivate"`, and `"publicRead"`. |
| `↳ maxBytesRewrittenPerCall` | `string` The maximum number of bytes that will be rewritten per rewrite request. Most callers shouldn't need to specify this parameter - it is primarily in place to support testing. If specified the value must be an integral multiple of 1 MiB (1048576). Also, this only applies to requests where the source and destination span locations and/or storage classes. |
| `↳ encryptionKey` | `string` A base64 encoded AES-256 customer-supplied encryption key. It will be neccesary to provide this when a key was used during the object's creation. |
| `↳ encryptionKeySHA256` | `string` Base64 encoded SHA256 hash of the customer-supplied encryption key. This value will be calculated from the `encryptionKey` on your behalf if not provided, but for best performance it is recommended to pass in a cached version of the already calculated SHA. |
| `↳ destinationEncryptionKey` | `string` A base64 encoded AES-256 customer-supplied encryption key that will be used to encrypt the rewritten object. |
| `↳ destinationEncryptionKeySHA256` | `string` Base64 encoded SHA256 hash of the customer-supplied destination encryption key. This value will be calculated from the `destinationEncryptionKey` on your behalf if not provided, but for best performance it is recommended to pass in a cached version of the already calculated SHA. |
| `↳ destinationKmsKeyName` | `string` Name of the Cloud KMS key that will be used to encrypt the object. Should be in the format `projects/my-project/locations/kr-location/keyRings/my-kr/cryptoKeys/my-key`. Please note the KMS key ring must use the same location as the destination bucket. |
| `↳ ifGenerationMatch` | `string` Makes the operation conditional on whether the destination object's current generation matches the given value. |
| `↳ ifGenerationNotMatch` | `string` Makes the operation conditional on whether the destination object's current generation does not match the given value. |
| `↳ ifMetagenerationMatch` | `string` Makes the operation conditional on whether the destination object's current metageneration matches the given value. |
| `↳ ifMetagenerationNotMatch` | `string` Makes the operation conditional on whether the destination object's current metageneration does not match the given value. |
| `↳ ifSourceGenerationMatch` | `string` Makes the operation conditional on whether the source object's current generation matches the given value. |
| `↳ ifSourceGenerationNotMatch` | `string` Makes the operation conditional on whether the source object's current generation does not match the given value. |
| `↳ ifSourceMetagenerationMatch` | `string` Makes the operation conditional on whether the source object's current metageneration matches the given value. |
| `↳ ifSourceMetagenerationNotMatch` | `string` Makes the operation conditional on whether the source object's current metageneration does not match the given value. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-storage/latest/StorageObject` |   |

### move

See also:

- [Objects move API documentation.](https://cloud.google.com/storage/docs/json_api/v1/objects/move)

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `destinationObject` | `string` The destination object. |
| `options` | `array` \[optional\] Configuration options. @type string $ifGenerationMatch Makes the operation conditional on whether the destination object's current generation matches the given value. @type string $ifGenerationNotMatch Makes the operation conditional on whether the destination object's current generation does not match the given value. @type string $ifMetagenerationMatch Makes the operation conditional on whether the destination object's current metageneration matches the given value. @type string $ifMetagenerationNotMatch Makes the operation conditional on whether the destination object's current metageneration does not match the given value. @type string $ifSourceGenerationMatch Makes the operation conditional on whether the source object's current generation matches the given value. @type string $ifSourceGenerationNotMatch Makes the operation conditional on whether the source object's current generation does not match the given value. @type string $ifSourceMetagenerationMatch Makes the operation conditional on whether the source object's current metageneration matches the given value. @type string $ifSourceMetagenerationNotMatch Makes the operation conditional on whether the source object's current metageneration does not match the given value. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-storage/latest/StorageObject` |   |

### rename

Renames the object.

Please note that there is no atomic rename provided by the Storage API.
This method is for convenience and is a set of sequential calls to copy
and delete. Upon success the source object's metadata will be cleared,
please use the returned object instead.

Example:

    $object2 = $object->rename('object2.txt');
    echo $object2->name();

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `name` | `string` The new name. |
| `options` | `array` Configuration options. |
| `↳ predefinedAcl` | `string` Predefined ACL to apply to the object. Acceptable values include, `"authenticatedRead"`, `"bucketOwnerFullControl"`, `"bucketOwnerRead"`, `"private"`, `"projectPrivate"`, and `"publicRead"`. |
| `↳ encryptionKey` | `string` A base64 encoded AES-256 customer-supplied encryption key. It will be neccesary to provide this when a key was used during the object's creation. |
| `↳ encryptionKeySHA256` | `string` Base64 encoded SHA256 hash of the customer-supplied encryption key. This value will be calculated from the `encryptionKey` on your behalf if not provided, but for best performance it is recommended to pass in a cached version of the already calculated SHA. |
| `↳ ifGenerationMatch` | `string` Makes the operation conditional on whether the destination object's current generation matches the given value. |
| `↳ ifGenerationNotMatch` | `string` Makes the operation conditional on whether the destination object's current generation does not match the given value. |
| `↳ ifMetagenerationMatch` | `string` Makes the operation conditional on whether the destination object's current metageneration matches the given value. |
| `↳ ifMetagenerationNotMatch` | `string` Makes the operation conditional on whether the destination object's current metageneration does not match the given value. |
| `↳ ifSourceGenerationMatch` | `string` Makes the operation conditional on whether the source object's current generation matches the given value. |
| `↳ ifSourceGenerationNotMatch` | `string` Makes the operation conditional on whether the source object's current generation does not match the given value. |
| `↳ ifSourceMetagenerationMatch` | `string` Makes the operation conditional on whether the source object's current metageneration matches the given value. |
| `↳ ifSourceMetagenerationNotMatch` | `string` Makes the operation conditional on whether the source object's current metageneration does not match the given value. |
| `↳ destinationBucket` | `string` Will move to this bucket if set. If not set, will default to the same bucket. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-storage/latest/StorageObject` | The renamed object. |

### downloadAsString

See also:

- [Objects get API documentation.](https://cloud.google.com/storage/docs/json_api/v1/objects/get)
- [Learn more about the Range header.](https://cloud.google.com/storage/docs/json_api/v1/parameters#range)

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `options` | `array` Configuration Options. |
| `↳ encryptionKey` | `string` An AES-256 customer-supplied encryption key. It will be neccesary to provide this when a key was used during the object's creation. If provided one must also include an `encryptionKeySHA256`. |
| `↳ encryptionKeySHA256` | `string` The SHA256 hash of the customer-supplied encryption key. It will be neccesary to provide this when a key was used during the object's creation. If provided one must also include an `encryptionKey`. |

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

### downloadToFile

See also:

- [Objects get API documentation.](https://cloud.google.com/storage/docs/json_api/v1/objects/get)
- [Learn more about the Range header.](https://cloud.google.com/storage/docs/json_api/v1/parameters#range)

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `path` | `string` Path to download the file to. |
| `options` | `array` Configuration Options. |
| `↳ encryptionKey` | `string` An AES-256 customer-supplied encryption key. It will be neccesary to provide this when a key was used during the object's creation. If provided one must also include an `encryptionKeySHA256`. |
| `↳ encryptionKeySHA256` | `string` The SHA256 hash of the customer-supplied encryption key. It will be neccesary to provide this when a key was used during the object's creation. If provided one must also include an `encryptionKey`. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Psr\Http\Message\StreamInterface` |   |

### downloadAsStream

See also:

- [Objects get API documentation.](https://cloud.google.com/storage/docs/json_api/v1/objects/get)
- [Learn more about the Range header.](https://cloud.google.com/storage/docs/json_api/v1/parameters#range)

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `options` | `array` Configuration Options. |
| `↳ encryptionKey` | `string` An AES-256 customer-supplied encryption key. It will be neccesary to provide this when a key was used during the object's creation. If provided one must also include an `encryptionKeySHA256`. |
| `↳ encryptionKeySHA256` | `string` The SHA256 hash of the customer-supplied encryption key. It will be neccesary to provide this when a key was used during the object's creation. If provided one must also include an `encryptionKey`. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Psr\Http\Message\StreamInterface` |   |

### downloadAsStreamAsync

See also:

- [Objects get API documentation.](https://cloud.google.com/storage/docs/json_api/v1/objects/get)
- [Learn more about the Range header.](https://cloud.google.com/storage/docs/json_api/v1/parameters#range)
- [Learn more about Guzzle Promises](https://github.com/guzzle/promises)

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `options` | `array` Configuration Options. |
| `↳ encryptionKey` | `string` An AES-256 customer-supplied encryption key. It will be neccesary to provide this when a key was used during the object's creation. If provided one must also include an `encryptionKeySHA256`. |
| `↳ encryptionKeySHA256` | `string` The SHA256 hash of the customer-supplied encryption key. It will be neccesary to provide this when a key was used during the object's creation. If provided one must also include an `encryptionKey`. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.aws.amazon.com/aws-sdk-php/v3/api/class-GuzzleHttp.Promise.Promise.html<Psr\Http\Message\StreamInterface>` |   |

### signedUrl

See also:

- [Signed URLs](https://cloud.google.com/storage/docs/access-control/signed-urls)

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `expires` | `https://docs.cloud.google.com/php/docs/reference/cloud-core/latest/Timestamp.html|DateTimeInterface|int` Specifies when the URL will expire. May provide an instance of [Google\\Cloud\\Core\\Timestamp](https://docs.cloud.google.com/php/docs/reference/cloud-core/latest/Timestamp.html), [http://php.net/datetimeimmutable](https://docs.cloud.google.com/php/docs/reference/cloud-storage/latest/`\DateTimeImmutable`), or a UNIX timestamp as an integer. |
| `options` | `array` Configuration Options. |
| `↳ bucketBoundHostname` | `string` The hostname for the bucket, for instance `cdn.example.com`. May be used for Google Cloud Load Balancers or for custom bucket CNAMEs. **Defaults to** `storage.googleapis.com`. |
| `↳ contentMd5` | `string` The MD5 digest value in base64. If you provide this, the client must provide this HTTP header with this same value in its request. If provided, take care to always provide this value as a base64 encoded string. |
| `↳ contentType` | `string` If you provide this value, the client must provide this HTTP header set to the same value. |
| `↳ forceOpenssl` | `bool` If true, OpenSSL will be used regardless of whether phpseclib is available. **Defaults to** `false`. |
| `↳ headers` | `array` If additional headers are provided, the server will check to make sure that the client provides matching values. Provide headers as a key/value array, where the key is the header name, and the value is an array of header values. Headers with multiple values may provide values as a simple array, or a comma-separated string. For a reference of allowed headers, see [Reference Headers](https://cloud.google.com/storage/docs/xml-api/reference-headers). Header values will be trimmed of leading and trailing spaces, multiple spaces within values will be collapsed to a single space, and line breaks will be replaced by an empty string. V2 Signed URLs may not provide `x-goog-encryption-key` or `x-goog-encryption-key-sha256` headers. |
| `↳ credentialsFetcher` | `FetchAuthTokenInterface` A credentials fetcher instance. |
| `↳ keyFile` | `array` \[DEPRECATED\] This option is being deprecated because of a potential security risk. This option does not validate the credential configuration. The security risk occurs when a credential configuration is accepted from a source that is not under your control and used without validation on your side. If you know that you will be loading credential configurations of a specific type, it is recommended to create the credentials directly and configure them using the `credentialsFetcher` option instead. `use Google\Auth\Credentials\ServiceAccountCredentials; $credentialsFetcher = new ServiceAccountCredentials($scopes, $json);` This will ensure that an unexpected credential type with potential for malicious intent is not loaded unintentionally. You might still have to do validation for certain credential types. If you are loading your credential configuration from an untrusted source and have not mitigated the risks (e.g. by validating the configuration yourself), make these changes as soon as possible to prevent security risks to your environment. Regardless of the method used, it is always your responsibility to validate configurations received from external sources. @see <https://cloud.google.com/docs/authentication/external/externally-sourced-credentials> |
| `↳ keyFilePath` | `string` \[DEPRECATED\] This option is being deprecated because of a potential security risk. This option does not validate the credential configuration. The security risk occurs when a credential configuration is accepted from a source that is not under your control and used without validation on your side. If you know that you will be loading credential configurations of a specific type, it is recommended to create the credentials directly and configure them using the `credentialsFetcher` option instead. `use Google\Auth\Credentials\ServiceAccountCredentials; $credentialsFetcher = new ServiceAccountCredentials($scopes, $json);` This will ensure that an unexpected credential type with potential for malicious intent is not loaded unintentionally. You might still have to do validation for certain credential types. If you are loading your credential configuration from an untrusted source and have not mitigated the risks (e.g. by validating the configuration yourself), make these changes as soon as possible to prevent security risks to your environment. Regardless of the method used, it is always your responsibility to validate configurations received from external sources. @see <https://cloud.google.com/docs/authentication/external/externally-sourced-credentials> |
| `↳ method` | `string` One of `GET`, `PUT` or `DELETE`. **Defaults to** `GET`. |
| `↳ responseDisposition` | `string` The [`response-content-disposition`](http://www.iana.org/assignments/cont-disp/cont-disp.xhtml) parameter of the signed url. |
| `↳ responseType` | `string` The `response-content-type` parameter of the signed url. When the server contentType is `null`, this option may be used to control the content type of the response. |
| `↳ saveAsName` | `string` The filename to prompt the user to save the file as when the signed url is accessed. This is ignored if `$options.responseDisposition` is set. |
| `↳ scheme` | `string` Either `http` or `https`. Only used if a custom hostname is provided via `$options.bucketBoundHostname`. If a custom bucketBoundHostname is provided, **defaults to** `http`. In all other cases, **defaults to** `https`. |
| `↳ scopes` | `string|array` One or more authentication scopes to be used with a key file. This option is ignored unless `$options.keyFile` or `$options.keyFilePath` is set. |
| `↳ queryParams` | `array` Additional query parameters to be included as part of the signed URL query string. For allowed values, see [Reference Headers](https://cloud.google.com/storage/docs/xml-api/reference-headers#query). |
| `↳ version` | `string` One of "v2" or "v4". **Defaults to** `"v2"`. |
| `↳ virtualHostedStyle` | `bool` If `true`, URL will be of form `mybucket.storage.googleapis.com`. If `false`, `storage.googleapis.com/mybucket`. **Defaults to** `false`. |

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

### signedUploadUrl

Create a Signed Upload URL for this object.

This method differs from [StorageObject::signedUrl()](https://docs.cloud.google.com/php/docs/reference/cloud-storage/latest/StorageObject#_Google_Cloud_Storage_StorageObject__signedUrl__)
in that it allows you to initiate a new resumable upload session. This
can be used to allow non-authenticated users to insert an object into a
bucket.

In order to upload data, a session URI must be
obtained by sending an HTTP POST request to the URL returned from this
method. See the [Cloud Storage Documentation](https://goo.gl/b1ZiZm) for
more information.

If you prefer to skip this initial step, you may find
[StorageObject::beginSignedUploadSession()](https://docs.cloud.google.com/php/docs/reference/cloud-storage/latest/StorageObject#_Google_Cloud_Storage_StorageObject__beginSignedUploadSession__) to
fit your needs. Note that `beginSignedUploadSession()` cannot be used
with Google Cloud PHP's Signed URL Uploader, and does not support a
configurable expiration date.

Example:

    $url = $object->signedUploadUrl(new \DateTime('tomorrow'));

    // Use Signed URLs v4
    $url = $object->signedUploadUrl(new \DateTime('tomorrow'), [
        'version' => 'v4'
    ]);

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `expires` | `https://docs.cloud.google.com/php/docs/reference/cloud-core/latest/Timestamp.html|DateTimeInterface|int` Specifies when the URL will expire. May provide an instance of [Google\\Cloud\\Core\\Timestamp](https://docs.cloud.google.com/php/docs/reference/cloud-core/latest/Timestamp.html), [http://php.net/datetimeimmutable](https://docs.cloud.google.com/php/docs/reference/cloud-storage/latest/`\DateTimeImmutable`), or a UNIX timestamp as an integer. |
| `options` | `array` Configuration Options. |
| `↳ contentMd5` | `string` The MD5 digest value in base64. If you provide this, the client must provide this HTTP header with this same value in its request. If provided, take care to always provide this value as a base64 encoded string. |
| `↳ contentType` | `string` If you provide this value, the client must provide this HTTP header set to the same value. |
| `↳ forceOpenssl` | `bool` If true, OpenSSL will be used regardless of whether phpseclib is available. **Defaults to** `false`. |
| `↳ headers` | `array` If additional headers are provided, the server will check to make sure that the client provides matching values. Provide headers as a key/value array, where the key is the header name, and the value is an array of header values. Headers with multiple values may provide values as a simple array, or a comma-separated string. For a reference of allowed headers, see [Reference Headers](https://cloud.google.com/storage/docs/xml-api/reference-headers). Header values will be trimmed of leading and trailing spaces, multiple spaces within values will be collapsed to a single space, and line breaks will be replaced by an empty string. V2 Signed URLs may not provide `x-goog-encryption-key` or `x-goog-encryption-key-sha256` headers. |
| `↳ credentialsFetcher` | `FetchAuthTokenInterface` A credentials fetcher instance. |
| `↳ keyFile` | `array` \[DEPRECATED\] This option is being deprecated because of a potential security risk. This option does not validate the credential configuration. The security risk occurs when a credential configuration is accepted from a source that is not under your control and used without validation on your side. If you know that you will be loading credential configurations of a specific type, it is recommended to create the credentials directly and configure them using the `credentialsFetcher` option instead. `use Google\Auth\Credentials\ServiceAccountCredentials; $credentialsFetcher = new ServiceAccountCredentials($scopes, $json);` This will ensure that an unexpected credential type with potential for malicious intent is not loaded unintentionally. You might still have to do validation for certain credential types. If you are loading your credential configuration from an untrusted source and have not mitigated the risks (e.g. by validating the configuration yourself), make these changes as soon as possible to prevent security risks to your environment. Regardless of the method used, it is always your responsibility to validate configurations received from external sources. @see <https://cloud.google.com/docs/authentication/external/externally-sourced-credentials> |
| `↳ keyFilePath` | `string` \[DEPRECATED\] This option is being deprecated because of a potential security risk. This option does not validate the credential configuration. The security risk occurs when a credential configuration is accepted from a source that is not under your control and used without validation on your side. If you know that you will be loading credential configurations of a specific type, it is recommended to create the credentials directly and configure them using the `credentialsFetcher` option instead. `use Google\Auth\Credentials\ServiceAccountCredentials; $credentialsFetcher = new ServiceAccountCredentials($scopes, $json);` This will ensure that an unexpected credential type with potential for malicious intent is not loaded unintentionally. You might still have to do validation for certain credential types. If you are loading your credential configuration from an untrusted source and have not mitigated the risks (e.g. by validating the configuration yourself), make these changes as soon as possible to prevent security risks to your environment. Regardless of the method used, it is always your responsibility to validate configurations received from external sources. @see <https://cloud.google.com/docs/authentication/external/externally-sourced-credentials> |
| `↳ responseDisposition` | `string` The [`response-content-disposition`](http://www.iana.org/assignments/cont-disp/cont-disp.xhtml) parameter of the signed url. |
| `↳ responseType` | `string` The `response-content-type` parameter of the signed url. When the server contentType is `null`, this option may be used to control the content type of the response. |
| `↳ saveAsName` | `string` The filename to prompt the user to save the file as when the signed url is accessed. This is ignored if `$options.responseDisposition` is set. |
| `↳ scheme` | `string` Either `http` or `https`. Only used if a custom hostname is provided via `$options.bucketBoundHostname`. In all other cases, `https` is used. When a custom bucketBoundHostname is provided, **defaults to** `http`. |
| `↳ scopes` | `string|array` One or more authentication scopes to be used with a key file. This option is ignored unless `$options.keyFile` or `$options.keyFilePath` is set. |
| `↳ queryParams` | `array` Additional query parameters to be included as part of the signed URL query string. For allowed values, see [Reference Headers](https://cloud.google.com/storage/docs/xml-api/reference-headers#query). |
| `↳ version` | `string` One of "v2" or "v4". **Defaults to** `"v2"`. |

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

### beginSignedUploadSession

See also:

- [Resumable Upload Best Practices](https://cloud.google.com/storage/docs/xml-api/resumable-upload#practices)

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `options` | `array` Configuration Options. |
| `↳ contentMd5` | `string` The MD5 digest value in base64. If you provide this, the client must provide this HTTP header with this same value in its request. If provided, take care to always provide this value as a base64 encoded string. |
| `↳ contentType` | `string` If you provide this value, the client must provide this HTTP header set to the same value. |
| `↳ forceOpenssl` | `bool` If true, OpenSSL will be used regardless of whether phpseclib is available. **Defaults to** `false`. |
| `↳ headers` | `array` If additional headers are provided, the server will check to make sure that the client provides matching values. Provide headers as a key/value array, where the key is the header name, and the value is an array of header values. Headers with multiple values may provide values as a simple array, or a comma-separated string. For a reference of allowed headers, see [Reference Headers](https://cloud.google.com/storage/docs/xml-api/reference-headers). Header values will be trimmed of leading and trailing spaces, multiple spaces within values will be collapsed to a single space, and line breaks will be replaced by an empty string. V2 Signed URLs may not provide `x-goog-encryption-key` or `x-goog-encryption-key-sha256` headers. |
| `↳ credentialsFetcher` | `FetchAuthTokenInterface` A credentials fetcher instance. |
| `↳ keyFile` | `array` \[DEPRECATED\] This option is being deprecated because of a potential security risk. This option does not validate the credential configuration. The security risk occurs when a credential configuration is accepted from a source that is not under your control and used without validation on your side. If you know that you will be loading credential configurations of a specific type, it is recommended to create the credentials directly and configure them using the `credentialsFetcher` option instead. `use Google\Auth\Credentials\ServiceAccountCredentials; $credentialsFetcher = new ServiceAccountCredentials($scopes, $json);` This will ensure that an unexpected credential type with potential for malicious intent is not loaded unintentionally. You might still have to do validation for certain credential types. If you are loading your credential configuration from an untrusted source and have not mitigated the risks (e.g. by validating the configuration yourself), make these changes as soon as possible to prevent security risks to your environment. Regardless of the method used, it is always your responsibility to validate configurations received from external sources. @see <https://cloud.google.com/docs/authentication/external/externally-sourced-credentials> |
| `↳ keyFilePath` | `string` \[DEPRECATED\] This option is being deprecated because of a potential security risk. This option does not validate the credential configuration. The security risk occurs when a credential configuration is accepted from a source that is not under your control and used without validation on your side. If you know that you will be loading credential configurations of a specific type, it is recommended to create the credentials directly and configure them using the `credentialsFetcher` option instead. `use Google\Auth\Credentials\ServiceAccountCredentials; $credentialsFetcher = new ServiceAccountCredentials($scopes, $json);` This will ensure that an unexpected credential type with potential for malicious intent is not loaded unintentionally. You might still have to do validation for certain credential types. If you are loading your credential configuration from an untrusted source and have not mitigated the risks (e.g. by validating the configuration yourself), make these changes as soon as possible to prevent security risks to your environment. Regardless of the method used, it is always your responsibility to validate configurations received from external sources. @see <https://cloud.google.com/docs/authentication/external/externally-sourced-credentials> "Access-Control-Allow-Origin". **Defaults to** `"*"`. |
| `↳ scopes` | `string|array` One or more authentication scopes to be used with a key file. This option is ignored unless `$options.keyFile` or `$options.keyFilePath` is set. |
| `↳ queryParams` | `array` Additional query parameters to be included as part of the signed URL query string. For allowed values, see [Reference Headers](https://cloud.google.com/storage/docs/xml-api/reference-headers#query). |
| `↳ version` | `string` One of "v2" or "v4". **Defaults to** `"v2"`. |

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

### info

See also:

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

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `options` | `array` Configuration options. |
| `↳ encryptionKey` | `string` An AES-256 customer-supplied encryption key. It will be neccesary to provide this when a key was used during the object's creation in order to retrieve the MD5 hash and CRC32C checksum. If provided one must also include an `encryptionKeySHA256`. |
| `↳ encryptionKeySHA256` | `string` The SHA256 hash of the customer-supplied encryption key. It will be neccesary to provide this when a key was used during the object's creation in order to retrieve the MD5 hash and CRC32C checksum. If provided one must also include an `encryptionKey`. |
| `↳ ifGenerationMatch` | `string` Makes the operation conditional on whether the object's current generation matches the given value. |
| `↳ ifGenerationNotMatch` | `string` Makes the operation conditional on whether the object's current generation does not match the given value. |
| `↳ ifMetagenerationMatch` | `string` Makes the operation conditional on whether the object's current metageneration matches the given value. |
| `↳ ifMetagenerationNotMatch` | `string` Makes the operation conditional on whether the object's current metageneration does not match the given value. |
| `↳ projection` | `string` Determines which properties to return. May be either 'full' or 'noAcl'. |

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

### reload

See also:

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

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `options` | `array` Configuration options. |
| `↳ encryptionKey` | `string` A base64 encoded AES-256 customer-supplied encryption key. It will be neccesary to provide this when a key was used during the object's creation. |
| `↳ encryptionKeySHA256` | `string` Base64 encoded SHA256 hash of the customer-supplied encryption key. This value will be calculated from the `encryptionKey` on your behalf if not provided, but for best performance it is recommended to pass in a cached version of the already calculated SHA. |
| `↳ ifGenerationMatch` | `string` Makes the operation conditional on whether the object's current generation matches the given value. |
| `↳ ifGenerationNotMatch` | `string` Makes the operation conditional on whether the object's current generation does not match the given value. |
| `↳ ifMetagenerationMatch` | `string` Makes the operation conditional on whether the object's current metageneration matches the given value. |
| `↳ ifMetagenerationNotMatch` | `string` Makes the operation conditional on whether the object's current metageneration does not match the given value. |
| `↳ projection` | `string` Determines which properties to return. May be either 'full' or 'noAcl'. |

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

### name

Retrieves the object's name.

Example:

    echo $object->name();

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

### identity

Retrieves the object's identity.

Example:

    echo $object->identity()['object'];

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

### gcsUri

Formats the object as a string in the following format:
`gs://{bucket-name}/{object-name}`.

Example:

    echo $object->gcsUri();

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

## Constants

### DEFAULT_DOWNLOAD_URL

    Value: \Google\Cloud\Storage\SigningHelper::DEFAULT_DOWNLOAD_HOST