Skip to content

AzureTableClient

Minimal Azure Table Storage REST client using the Table service’s “Shared Key Lite” authentication scheme — a cheaper option than Blob Storage for small key/value-shaped session payloads (no per-account container needed; entities are addressed by table + partition/row key).

Only the three entity operations AzureTableSessionPersistence needs: ensure-table, upsert entity, get entity, delete entity.

final class AzureTableClient

SourceAzureTableClient.php

public function __construct(ClientInterface $httpClient, string $accountName, string $accountKey, ?string $endpoint = null, Psr17Factory $psr17 = new Psr17Factory(…)): mixed

ParameterTypeDescription
$httpClientClientInterface
$accountNamestring
$accountKeystring
$endpoint?``string
$psr17Psr17Factory

Returns mixed

MethodDescription
delete(string $table, string $partitionKey, string $rowKey): voidDeletes one entity, treating a missing one as success.
ensureTableExists(string $table): voidCreates the table, treating “already exists” as success.
[`get(string $table, string $partitionKey, string $rowKey): array<string, mixed>null`](#get)
upsert(string $table, string $partitionKey, string $rowKey, array<string, mixed> $properties): void

public function delete(string $table, string $partitionKey, string $rowKey): void

Deletes one entity, treating a missing one as success.

Sends If-Match: *, so the entity is removed whatever its current ETag — this is an unconditional delete, not an optimistic-concurrency one. A 404 returns normally so the call is idempotent.

ParameterTypeDescription
$tablestring
$partitionKeystring
$rowKeystring
ThrowsWhen
AzureStorageExceptionOn any other 4xx/5xx status, or a transport failure that survived the retries.

public function ensureTableExists(string $table): void

Creates the table, treating “already exists” as success.

A 409 means another caller created it first, which is the desired end state, so both 201 and 409 return normally.

ParameterTypeDescription
$tablestring
ThrowsWhen
AzureStorageExceptionOn any other status, or if the request could not be sent after the configured retries.
JsonExceptionIf the table name cannot be encoded.

public function get(string $table, string $partitionKey, string $rowKey): array<string, mixed>|null

ParameterTypeDescription
$tablestring
$partitionKeystring
$rowKeystring

Returns array``<``string``, ``mixed``>``|``null

public function upsert(string $table, string $partitionKey, string $rowKey, array<string, mixed> $properties): void

ParameterTypeDescription
$tablestring
$partitionKeystring
$rowKeystring
$propertiesarray``<``string``, ``mixed``>