Skip to content

ListableObjectStoreClientInterface

An ObjectStoreClientInterface whose store can also enumerate what it holds.

Separate from the base contract for the same reason ListableFilesystemInterface is separate from FilesystemAdapterInterface: a consumer that only needs get/put/delete/head should not have to know whether the store behind the interface can list, and one that does need listing should fail to wire up rather than fail at first call.

Pagination, prefix/delimiter grouping and per-entry metadata are normalized the same way across providers even though S3 (an opaque continuation token), GCS and Azure (both a marker, echoed back as ObjectListing::$nextContinuationToken) each name and shape it differently on the wire.

interface ListableObjectStoreClientInterface extends ObjectStoreClientInterface

ImplementsObjectStoreClientInterface
Implemented byAzureBlobContainerClient, GcsClient, S3Client
Since4.2.0
SourceListableObjectStoreClientInterface.php
MethodDescription
listObjects(string $prefix = '', string $delimiter = '', ?string $continuationToken = null, int $maxKeys = 1000): ObjectListingLists up to $maxKeys keys starting with $prefix, oldest API quirks aside the same one page at a time on every provider.

abstract public function listObjects(string $prefix = '', string $delimiter = '', ?string $continuationToken = null, int $maxKeys = 1000): ObjectListing

Lists up to $maxKeys keys starting with $prefix, oldest API quirks aside the same one page at a time on every provider.

With $delimiter empty, every matching key comes back as an ObjectSummary in ObjectListing::$objects — a fully recursive listing. With $delimiter set, a key is only listed that way when $prefix (plus nothing else) reaches it before the first occurrence of $delimiter; everything past that point is collapsed into one entry per distinct prefix-up-to-and-including-the-delimiter in ObjectListing::$commonPrefixes instead — the “one directory level” view every provider’s own console uses.

$continuationToken must be null on the first call and, for a truncated result, ObjectListing::$nextContinuationToken verbatim on the next — it is opaque, provider specific, and never meant to be inspected or constructed by a caller.

ParameterTypeDescription
$prefixstring
$delimiterstring
$continuationToken?``string
$maxKeysint

Returns ObjectListing

ThrowsWhen
ObjectStoreExceptionOn a transport or provider failure.

These come from an ancestor and are documented where they are declared.

MethodDeclared inDescription
delete()ObjectStoreClientInterfaceRemove the object at $key.
get()ObjectStoreClientInterfaceThe object’s contents, or null when no object exists at $key.
head()ObjectStoreClientInterfaceThe object’s metadata, or null when no object exists at $key.
put()ObjectStoreClientInterfaceCreate or replace the object at $key.