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.
Synopsis
Section titled “Synopsis”interface ListableObjectStoreClientInterface extends ObjectStoreClientInterface
| Implements | ObjectStoreClientInterface |
| Implemented by | AzureBlobContainerClient, GcsClient, S3Client |
| Since | 4.2.0 |
| Source | ListableObjectStoreClientInterface.php |
Methods
Section titled “Methods”| Method | Description |
|---|---|
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. |
listObjects()
Section titled “listObjects()”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.
| Parameter | Type | Description |
|---|---|---|
$prefix | string | |
$delimiter | string | |
$continuationToken | ?``string | |
$maxKeys | int |
Returns ObjectListing
| Throws | When |
|---|---|
ObjectStoreException | On a transport or provider failure. |
Inherited methods
Section titled “Inherited methods”These come from an ancestor and are documented where they are declared.
| Method | Declared in | Description |
|---|---|---|
delete() | ObjectStoreClientInterface | Remove the object at $key. |
get() | ObjectStoreClientInterface | The object’s contents, or null when no object exists at $key. |
head() | ObjectStoreClientInterface | The object’s metadata, or null when no object exists at $key. |
put() | ObjectStoreClientInterface | Create or replace the object at $key. |