Skip to content

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.

interface ListableFilesystemInterface extends FilesystemAdapterInterface

ImplementsFilesystemAdapterInterface
Implemented byListableObjectStoreFilesystemAdapter, LocalFilesystemAdapter
Since3.2.0
SourceListableFilesystemInterface.php
MethodDescription
listContents(string $path = ''): list<string>The entries directly under $path.

abstract public function listContents(string $path = ''): list<string>

The entries directly under $path.

ParameterTypeDescription
$pathstring

Returns list``<``string``> — Relative paths, non-recursive.

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

MethodDeclared inDescription
delete()FilesystemAdapterInterfaceBest-effort: a no-op if $path does not exist.
exists()FilesystemAdapterInterfaceReports whether a file is stored at $path.
lastModified()FilesystemAdapterInterface
read()FilesystemAdapterInterface
size()FilesystemAdapterInterface
write()FilesystemAdapterInterfaceStores $contents at $path, replacing whatever was there.