FilesystemManager
class FilesystemManager implements Factory mixin Filesystem mixin FilesystemAdapter mixin ClientPooledFilesystem
Traits
Hosts must declare a protected array $poolableDrivers containing their default poolable drivers.
Constants
| protected ON_DEMAND_DISK_NAME |
The logical name used while resolving on-demand disks. |
| protected READ_THROUGH_CONTEXT_KEY_PREFIX |
The coroutine-local construction stack prefix for each manager. |
| protected GCS_CLIENT_OPTIONS |
Google Cloud Storage client constructor options supported by the installed SDK. |
Properties
| protected Closure> | $releaseCallbacks | from HasPoolProxy | |
| static protected null|list<string> | $s3ArgumentNames | ||
| protected array | $disks | The array of resolved filesystem drivers. |
|
| protected array | $customCreators | The registered custom driver creators. |
|
| protected array | $poolableDrivers | The array of drivers which will be wrapped as pool proxies. |
Methods
Create a pool proxy for an immutable definition.
Build a namespaced pool definition for a pooled resource.
Get the shared object-pool factory.
Get the release callback for a pooled driver.
Add a driver to the poolable-driver list.
Remove a driver from the poolable-driver list.
Set the poolable-driver list.
Get a filesystem instance.
Get a filesystem instance.
Build an on-demand disk.
Attempt to get the disk from the local cache.
Resolve the given disk.
Call a custom driver creator.
Create a whole-driver pooled disk for a resource the framework cannot split.
Create a client-pooled disk for a built-in cloud driver.
Derive the immutable pool definition for a disk configuration.
Create an instance of the local driver.
Create an instance of the ftp driver.
Create an instance of the sftp driver.
Create an instance of the Amazon S3 driver.
Create an instance of the read-through driver.
Get a side operator without exposing borrowed clients or losing native cloud reads.
Derive the S3 client construction config from a disk config.
Get the S3 client constructor argument names.
Create an S3 client from normalized client config.
Build an S3 disk adapter stack around a client.
Format the given S3 configuration with the default options.
Create an instance of the Google Cloud Storage driver.
Derive the Google Cloud Storage client construction config from a disk config.
Create a Google Cloud Storage client from normalized client config.
Build a Google Cloud Storage disk adapter stack around a client.
Format the given GCS configuration with the default options.
Validate and return an explicit SDK client-option block.
Create a scoped driver.
Create a Flysystem instance with the given adapter.
Set the given disk instance.
Get the filesystem connection configuration.
Get the default driver name.
Unset the given disk instances.
Disconnect the given disk, remove it from local cache, and close its pool.
Flush all static state.
Dynamically call the default driver instance.
No description
No description
Details
in
HasPoolProxy at line 27
protected mixed
createPoolProxy(string $driver, Closure $createCallback, PoolDefinition $definition, string $proxyClass)
Create a pool proxy for an immutable definition.
in
HasPoolProxy at line 48
protected PoolDefinition
poolDefinition(string $resource, array $poolConfig, array $fingerprintSource)
Build a namespaced pool definition for a pooled resource.
at line 948
protected Factory
poolFactory()
Get the shared object-pool factory.
in
HasPoolProxy at line 74
HasPoolProxy
setReleaseCallback(string $driver, Closure $callback)
Set the release callback for a pooled driver.
Boot-only. The callback persists on the manager for the worker lifetime and is captured by every subsequently created proxy for the driver.
in
HasPoolProxy at line 84
Closure|null
getReleaseCallback(string $driver)
Get the release callback for a pooled driver.
in
HasPoolProxy at line 96
HasPoolProxy
addPoolableDriver(string $driver)
Add a driver to the poolable-driver list.
Boot-only. The list persists on the manager for the worker lifetime and is consulted on subsequent driver creation. Per-request use races across coroutines and does not affect already-cached drivers.
in
HasPoolProxy at line 112
HasPoolProxy
removePoolableDriver(string $driver)
Remove a driver from the poolable-driver list.
Boot-only. The list persists on the manager for the worker lifetime and is consulted on subsequent driver creation. Per-request use races across coroutines and does not affect already-cached drivers.
in
HasPoolProxy at line 129
array
getPoolableDrivers()
Get the poolable-driver list.
in
HasPoolProxy at line 141
HasPoolProxy
setPoolableDrivers(array $poolableDrivers)
Set the poolable-driver list.
Boot-only. The list persists on the manager for the worker lifetime and is consulted on subsequent driver creation. Per-request use races across coroutines and does not affect already-cached drivers.
in
RebindsCallbacksToSelf at line 18
protected Closure|null
bindCallbackToSelf(Closure $callback)
Bind the provided callback to the class instance.
at line 112
__construct(Container $app)
Create a new filesystem manager instance.
at line 120
Filesystem
drive(UnitEnum|string|null $name = null)
Get a filesystem instance.
at line 128
Filesystem
disk(UnitEnum|string|null $name = null)
Get a filesystem instance.
at line 144
Filesystem
build(array|string $config, string|null $name = null)
Build an on-demand disk.
at line 165
protected Filesystem
get(string $name)
Attempt to get the disk from the local cache.
at line 175
protected Filesystem
resolve(string $name, array|null $config = null)
Resolve the given disk.
at line 276
protected Filesystem
callCustomCreator(array $config, string|null $name = null)
Call a custom driver creator.
at line 292
protected FilesystemPoolProxy
createDriverPooledDisk(string $driver, array $config, string|null $name, string|null $servingRouteDisk, string $servingRoutePrefix, Closure $createCallback)
Create a whole-driver pooled disk for a resource the framework cannot split.
at line 312
protected ClientPooledFilesystem
createClientPooledDisk(string $driver, array $config)
Create a client-pooled disk for a built-in cloud driver.
at line 348
protected PoolDefinition
diskPoolDefinition(string $driver, array $config, string|null $name, string|null $servingRouteDisk, string $servingRoutePrefix)
Derive the immutable pool definition for a disk configuration.
at line 370
Filesystem
createLocalDriver(array $config, string $name = 'local')
Create an instance of the local driver.
at line 403
Filesystem
createFtpDriver(array $config)
Create an instance of the ftp driver.
at line 417
Filesystem
createSftpDriver(array $config)
Create an instance of the sftp driver.
at line 435
Cloud
createS3Driver(array $config)
Create an instance of the Amazon S3 driver.
at line 446
Filesystem
createReadThroughDriver(array $config, string $name = 'read-through')
Create an instance of the read-through driver.
at line 519
protected FilesystemOperator
readThroughOperator(Cloud $disk)
Get a side operator without exposing borrowed clients or losing native cloud reads.
at line 535
protected array
s3ClientConfig(array $config)
Derive the S3 client construction config from a disk config.
at line 553
static protected array
s3ArgumentNames()
Get the S3 client constructor argument names.
The SDK argument set is immutable for the worker's installed version.
at line 561
protected S3Client
createS3Client(array $clientConfig)
Create an S3 client from normalized client config.
at line 569
protected AwsS3V3Adapter
buildS3Disk(S3Client $client, array $config)
Build an S3 disk adapter stack around a client.
at line 594
protected array
formatS3Config(array $config)
Format the given S3 configuration with the default options.
at line 615
Cloud
createGcsDriver(array $config)
Create an instance of the Google Cloud Storage driver.
at line 626
protected array
gcsClientConfig(array $config)
Derive the Google Cloud Storage client construction config from a disk config.
at line 639
protected StorageClient
createGcsClient(array $clientConfig)
Create a Google Cloud Storage client from normalized client config.
at line 647
protected GoogleCloudStorageAdapter
buildGcsDisk(StorageClient $client, array $config)
Build a Google Cloud Storage disk adapter stack around a client.
at line 681
protected array
formatGcsConfig(array $config)
Format the given GCS configuration with the default options.
at line 700
protected array
clientConfigBlock(array $config, array $supportedKeys)
Validate and return an explicit SDK client-option block.
at line 725
Filesystem
createScopedDriver(array $config, string|null $name = null)
Create a scoped driver.
at line 892
protected FilesystemOperator
createFlysystem(FilesystemAdapter $adapter, array $config)
Create a Flysystem instance with the given adapter.
at line 924
FilesystemManager
set(string $name, mixed $disk)
Set the given disk instance.
Boot or tests only. Mutates the singleton's disk cache; concurrent coroutines may already hold a reference to the prior disk and next resolution will return the replacement. Any shared pool remains available until its idle TTL expires or purge() invalidates it.
at line 934
protected array
getConfig(string $name)
Get the filesystem connection configuration.
at line 956
string
getDefaultDriver()
Get the default driver name.
at line 969
FilesystemManager
forgetDisk(array|string $disk)
Unset the given disk instances.
Boot or tests only. Mutates the singleton's disk cache; concurrent coroutines may already hold a reference to the disk and next resolution will rebuild a wrapper. Shared pools remain available until their idle TTL expires or purge() deliberately invalidates them.
at line 985
void
purge(string|null $name = null)
Disconnect the given disk, remove it from local cache, and close its pool.
Boot or tests only, plus operational recovery of broken pooled resources. Closing deliberately invalidates a shared pool; other converged disks acquire a fresh pool on their next operation.
at line 1017
FilesystemManager
extend(string $driver, Closure $callback, bool $poolable = false)
Register a custom driver creator Closure.
Anonymous closures run in this manager's class scope; non-static closures also receive the manager as $this.
Boot-only. The callback persists in the singleton's customCreators array (and the poolable list if $poolable is true) for the worker lifetime and applies to every subsequent disk resolution.
at line 1041
FilesystemManager
setApplication(Container $app)
Set the application instance used by the manager.
Tests only. Swaps the singleton's container reference; per-request use races across coroutines and breaks every concurrent filesystem operation.
at line 1051
static void
flushState()
Flush all static state.
at line 1059
mixed
__call(string $method, array $parameters)
Dynamically call the default driver instance.
at line 52
Filesystem|mixed
when(Closure|mixed $value = 'null', null|callable $callback = 'null', null|callable $default = 'null')
No description
at line 52
Filesystem|mixed
unless(Closure|mixed $value = 'null', null|callable $callback = 'null', null|callable $default = 'null')
No description