Tiger_Media_Storage_Azure
@api· implementsTiger_Media_Storage_Interface
Tiger_Media_Storage_Azure — Azure Blob Storage media storage.
Same contract as the S3/GCS adapters, adapted to Azure's model where public access is a container-level setting (not per-object/prefix). Two layouts:
- Two containers (set BOTH
public_container+private_container): visibility picks the container; make the public one's access level "blob". Blob name =<prefix><key>. - One container (
container): visibility picks a key prefix (public_prefix/private_prefix) within it, like S3/GCS. "Public" is only truly public if that container's access level allows it — else front it with a CDN.
PUBLIC → a direct CDN / *.blob.core.windows.net URL. PRIVATE → a short-lived SAS URL
(presign_ttl, needs the account key), or '' when the key is absent / presign_ttl=0 (the
media layer then streams through the ACL-checked /media/file/
Auth: a connection_string, or account + key. Requires microsoft/azure-storage-blob
(optional dependency — composer suggest / MEDIA.md); the adapter throws a clear message if
it's missing and only loads when an azure disk is used.
Methods
__construct()
__construct(array $config)
Configure containers, prefixes, CDN, and presign TTL from the disk config.
$configarray— themedia.disks.<name>.*settings
Throws RuntimeException — when neither a single container nor both public/private containers are set
put()
put($key, $sourcePath, $visibility, $mime = null)
Store bytes from a source file path as a block blob.
$keystring— the adapter-relative storage key$sourcePathstring— the source file on disk to read from$visibilitystring— public|private$mime?string— the content MIME type (may be null)
Throws RuntimeException — when the source can't be read or the blob can't be created
write()
write($key, $bytes, $visibility, $mime = null)
Store raw bytes as a block blob.
$keystring— the adapter-relative storage key$bytesstring— the raw bytes to store$visibilitystring— public|private$mime?string— the content MIME type (may be null)
get()
get($key, $visibility)
Read all bytes of a blob.
$keystring— the adapter-relative storage key$visibilitystring— public|private
Returns string — the blob's bytes
Throws RuntimeException — when the blob is not found
stream()
stream($key, $visibility)
Open a read stream for a blob.
$keystring— the adapter-relative storage key$visibilitystring— public|private
Returns resource — a readable stream for the blob
Throws RuntimeException — when the blob is not found
delete()
delete($key, $visibility)
Remove a blob (idempotent — a missing blob is not an error).
$keystring— the adapter-relative storage key$visibilitystring— public|private
exists()
exists($key, $visibility)
Does the blob exist?
$keystring— the adapter-relative storage key$visibilitystring— public|private
Returns bool — true when the blob exists
size()
size($key, $visibility)
Size of a blob in bytes (0 if missing).
$keystring— the adapter-relative storage key$visibilitystring— public|private
Returns int — the blob size in bytes, or 0 if missing
url()
url($key, $visibility, $ttl = null)
A directly-usable URL for a blob (CDN/endpoint for public, a SAS URL for private).
$keystring— the adapter-relative storage key$visibilitystring— public|private$ttl?int— seconds for the private SAS URL (adapter default when null)
Returns string — a usable URL, or '' when the app must stream the bytes itself