ListableFilesystemInterface
A filesystem that can enumerate what it holds.
Separate from FilesystemAdapterInterface because listing is the one operation a store may genuinely not offer: the S3, GCS and Azure adapters are built on single-object REST calls with no list endpoint, so they can read, write, delete, stat and test existence but cannot enumerate. Declaring listContents() on the base contract and throwing from three of four implementations made every consumer’s type useless — it could not tell whether the call would work without knowing which adapter it actually held.
Type-hint this where listing is required, and the wiring fails at the point a non-listable driver is configured rather than at the point it is called. Same shape as PollableQueueDriverInterface, for the same reason.
Synopsis
Section titled “Synopsis”interface ListableFilesystemInterface extends FilesystemAdapterInterface
| Implements | FilesystemAdapterInterface |
| Implemented by | ListableObjectStoreFilesystemAdapter, LocalFilesystemAdapter |
| Since | 3.2.0 |
| Source | ListableFilesystemInterface.php |
Methods
Section titled “Methods”| Method | Description |
|---|---|
listContents(string $path = ''): list<string> | The entries directly under $path. |
listContents()
Section titled “listContents()”abstract public function listContents(string $path = ''): list<string>
The entries directly under $path.
| Parameter | Type | Description |
|---|---|---|
$path | string |
Returns list``<``string``> — Relative paths, non-recursive.
Inherited methods
Section titled “Inherited methods”These come from an ancestor and are documented where they are declared.
| Method | Declared in | Description |
|---|---|---|
delete() | FilesystemAdapterInterface | Best-effort: a no-op if $path does not exist. |
exists() | FilesystemAdapterInterface | Reports whether a file is stored at $path. |
lastModified() | FilesystemAdapterInterface | |
read() | FilesystemAdapterInterface | |
size() | FilesystemAdapterInterface | |
write() | FilesystemAdapterInterface | Stores $contents at $path, replacing whatever was there. |