Azure OSS for PHP API Reference

BlobClient
in package

FinalYes

Provides operations for an Azure Storage blob.

Supports streaming downloads, automatic single-request or staged-block uploads, metadata and tag management, copy operations, leases, and SAS generation.

Table of Contents

Properties

$blobName  : string
$containerName  : string
$credential  : StorageSharedKeyCredential|TokenCredential|null
$uri  : UriInterface
$blockBlobClient  : BlockBlobClient
$client  : Client
$options  : BlobClientOptions

Methods

__construct()  : mixed
abortCopyFromUri()  : void
Aborts a pending copy operation identified by its copy ID.
abortCopyFromUriAsync()  : PromiseInterface
Asynchronously aborts a pending copy operation.
canGenerateSasUri()  : bool
Returns whether this client has a shared-key credential capable of signing a blob SAS.
delete()  : void
Deletes the blob.
deleteAsync()  : PromiseInterface
Asynchronously deletes the blob.
deleteIfExists()  : void
Deletes the blob if it exists.
deleteIfExistsAsync()  : PromiseInterface
Asynchronously deletes the blob if it exists.
downloadStreaming()  : BlobDownloadStreamingResult
Downloads the blob as a streaming response.
downloadStreamingAsync()  : PromiseInterface
Asynchronously downloads the blob as a streaming response.
exists()  : bool
Determines whether the blob exists.
existsAsync()  : PromiseInterface
Asynchronously determines whether the blob exists.
generateSasUri()  : UriInterface
Generates a URI for this blob containing a signed service SAS query string.
getBlobLeaseClient()  : BlobLeaseClient
Creates a lease client for this blob without making a service request.
getProperties()  : BlobProperties
Gets the blob's properties and metadata without downloading its content.
getPropertiesAsync()  : PromiseInterface
Asynchronously gets the blob's properties and metadata.
getTags()  : array<string|int, string>
Gets all index tags associated with the blob.
getTagsAsync()  : PromiseInterface
Asynchronously gets all index tags associated with the blob.
setHttpHeaders()  : void
Sets the blob's standard HTTP headers.
setHttpHeadersAsync()  : PromiseInterface
Asynchronously sets the blob's standard HTTP headers.
setMetadata()  : void
Replaces all user-defined metadata on the blob.
setMetadataAsync()  : PromiseInterface
Asynchronously replaces all user-defined metadata on the blob.
setTags()  : void
Replaces all index tags on the blob.
setTagsAsync()  : PromiseInterface
Asynchronously replaces all index tags on the blob.
startCopyFromUri()  : BlobCopyResult
Starts a potentially long-running server-side copy to this blob.
startCopyFromUriAsync()  : PromiseInterface
Asynchronously starts a potentially long-running server-side copy.
syncCopyFromUri()  : BlobCopyResult
Copies a source blob to this blob in a synchronous service operation.
syncCopyFromUriAsync()  : PromiseInterface
Asynchronously performs a synchronous server-side copy to this blob.
upload()  : void
Uploads content, staging blocks automatically when it exceeds the configured threshold.
uploadAsync()  : PromiseInterface
Asynchronously uploads content, staging blocks automatically when required.
waitForCopyCompletion()  : BlobProperties
Polls this blob until its current copy operation completes or the timeout expires.
getNextBlockId()  : string
resolveMaximumTransferSize()  : int
uploadViaBlockBlobAsync()  : PromiseInterface
uploadViaPutBlobAsync()  : PromiseInterface

Properties

$containerName read-only

public string $containerName

Methods

__construct()

public __construct(UriInterface $uri[, StorageSharedKeyCredential|TokenCredential|null $credential = null ][, BlobClientOptions $options = new BlobClientOptions() ]) : mixed
Parameters
$uri : UriInterface

URI of the blob, including any SAS query string.

$credential : StorageSharedKeyCredential|TokenCredential|null = null

Credential used to authorize requests, or null for anonymous/SAS access.

$options : BlobClientOptions = new BlobClientOptions()

Client transport and service-version options.

Tags
throws
InvalidBlobUriException

When the URI does not identify both a container and blob.

canGenerateSasUri()

Returns whether this client has a shared-key credential capable of signing a blob SAS.

public canGenerateSasUri() : bool
Return values
bool

exists()

Determines whether the blob exists.

public exists() : bool
Return values
bool

existsAsync()

Asynchronously determines whether the blob exists.

public existsAsync() : PromiseInterface
Return values
PromiseInterface

generateSasUri()

Generates a URI for this blob containing a signed service SAS query string.

public generateSasUri(BlobSasBuilder $blobSasBuilder) : UriInterface
Parameters
$blobSasBuilder : BlobSasBuilder
Tags
throws
UnableToGenerateSasException

When the client does not have a shared-key credential.

Return values
UriInterface

getBlobLeaseClient()

Creates a lease client for this blob without making a service request.

public getBlobLeaseClient([string|null $leaseId = null ]) : BlobLeaseClient
Parameters
$leaseId : string|null = null
Return values
BlobLeaseClient

waitForCopyCompletion()

Polls this blob until its current copy operation completes or the timeout expires.

public waitForCopyCompletion([int $pollingIntervalMs = 1000 ][, int|null $timeoutMs = null ]) : BlobProperties
Parameters
$pollingIntervalMs : int = 1000

Delay between property requests in milliseconds.

$timeoutMs : int|null = null

Maximum wait in milliseconds, or null for no timeout.

Return values
BlobProperties

getNextBlockId()

private getNextBlockId(array<string|int, string> $blockIds) : string
Parameters
$blockIds : array<string|int, string>
Return values
string

uploadViaBlockBlobAsync()

private uploadViaBlockBlobAsync(StreamInterface $content, int $maximumConcurrency, int $maximumTransferSize, BlobHttpHeaders $httpHeaders, BlobRequestConditions|null $conditions) : PromiseInterface
Parameters
$content : StreamInterface
$maximumConcurrency : int
$maximumTransferSize : int
$httpHeaders : BlobHttpHeaders
$conditions : BlobRequestConditions|null
Return values
PromiseInterface
On this page

Search results