ClientPooledFilesystem
class ClientPooledFilesystem implements Cloud, InvalidatesPool
Traits
Properties
| protected Closure|null | $serveCallback | from InteractsWithPooledFilesystem | |
| protected Closure|null | $temporaryUrlCallback | from InteractsWithPooledFilesystem | |
| protected Closure|null | $temporaryUploadUrlCallback | from InteractsWithPooledFilesystem |
Methods
Apply the callback if the given "value" is (or resolves to) truthy.
Apply the callback if the given "value" is (or resolves to) falsy.
Copy a file to another disk.
Move a file to another disk.
Transfer a file without holding a source lease during the destination write.
Assert that the given file or directory exists.
Assert that the number of files in path equals the expected count.
Assert that the given file or directory does not exist.
Assert that the given directory is empty.
Assert that the disk contains no files.
Determine if a file or directory exists.
Determine if a file or directory is missing.
Determine if a directory exists.
Determine if a directory is missing.
Get the full path to the file that exists at the given relative path.
Determine if a file or directory exists using the Flysystem operator.
Read a file using the Flysystem operator.
Get a file size using the Flysystem operator.
Get raw Flysystem visibility for a path.
Write a file using the Flysystem operator.
Create a directory using the Flysystem operator.
Get the contents of a file as decoded JSON.
Create a streamed response for a given file.
Create a streamed download response for a given file.
Create an image instance from a file in storage.
Write the contents of a file.
Store the uploaded file on the disk.
Store the uploaded file on the disk with a given name.
Get the visibility for the given path.
Set the visibility for the given path.
Prepend to a file.
Append to a file.
Delete the file at a given path.
Copy a file to a new location.
Move a file to a new location.
Get the checksum for a file.
Get the mime-type of a given file.
Get the file's last modification time.
Get a resource to read the partial file.
Write a new file using a stream.
Get the URL for the file at the given path.
Determine if temporary URLs can be generated.
Determine if temporary upload URLs can be generated.
Get a temporary URL for the file at the given path.
Get a temporary upload URL for the file at the given path.
Get an array of all files in a directory.
Get all of the files from the given directory recursively.
Get all of the directories within a given directory.
Get all of the directories within a given directory recursively.
Recursively delete a directory.
Reject access to the borrowed Flysystem driver.
Reject access to the borrowed Flysystem adapter.
Get an operator that owns each operation's borrow and each stream's lease.
Define a custom temporary upload URL builder callback.
Invoke a synchronous method against a per-operation stack.
Return idle database sessions before operations that can contact a provider.
Release buffered reads immediately and retain the lease for live streams.
Run a callback with an accessor result from a per-operation stack.
Build a file response using short borrows and a leased stream.
Create the exception used for every rejected borrowed-internal accessor.
Reject methods that have not been audited for deferred results.
Create a client-pooled filesystem.
Get the pooled client's definition.
Return the pool's fully qualified registry name.
Remove and close the current client pool.
Borrow a client and build its per-operation adapter stack.
Build a disk stack and apply every proxy-held callback.
Details
in
Conditionable at line 23
mixed
when(mixed $value = null, callable|null $callback = null, callable|null $default = null)
Apply the callback if the given "value" is (or resolves to) truthy.
in
Conditionable at line 56
mixed
unless(mixed $value = null, callable|null $callback = null, callable|null $default = null)
Apply the callback if the given "value" is (or resolves to) falsy.
in
TransfersFiles at line 21
bool
copyToDisk(Filesystem|string|UnitEnum $disk, string $from, string|null $to = null)
Copy a file to another disk.
in
TransfersFiles at line 33
bool
moveToDisk(Filesystem|string|UnitEnum $disk, string $from, string|null $to = null)
Move a file to another disk.
in
TransfersFiles at line 41
protected bool
transferFile(Filesystem $source, string $from, Filesystem $destination, string $to)
Transfer a file without holding a source lease during the destination write.
in
InteractsWithPooledFilesystem at line 49
InteractsWithPooledFilesystem
assertExists(array|string $path, string|null $content = null)
Assert that the given file or directory exists.
in
InteractsWithPooledFilesystem at line 59
InteractsWithPooledFilesystem
assertCount(string $path, int $count, bool $recursive = false)
Assert that the number of files in path equals the expected count.
in
InteractsWithPooledFilesystem at line 69
InteractsWithPooledFilesystem
assertMissing(array|string $path)
Assert that the given file or directory does not exist.
in
InteractsWithPooledFilesystem at line 79
InteractsWithPooledFilesystem
assertDirectoryEmpty(string $path)
Assert that the given directory is empty.
in
InteractsWithPooledFilesystem at line 89
InteractsWithPooledFilesystem
assertEmpty()
Assert that the disk contains no files.
in
InteractsWithPooledFilesystem at line 99
bool
exists(string $path)
Determine if a file or directory exists.
in
InteractsWithPooledFilesystem at line 107
bool
missing(string $path)
Determine if a file or directory is missing.
in
InteractsWithPooledFilesystem at line 115
bool
fileExists(string $path)
Determine if a file exists.
in
InteractsWithPooledFilesystem at line 123
bool
fileMissing(string $path)
Determine if a file is missing.
in
InteractsWithPooledFilesystem at line 131
bool
directoryExists(string $path)
Determine if a directory exists.
in
InteractsWithPooledFilesystem at line 139
bool
directoryMissing(string $path)
Determine if a directory is missing.
in
InteractsWithPooledFilesystem at line 147
string
path(string $path)
Get the full path to the file that exists at the given relative path.
in
InteractsWithPooledFilesystem at line 155
bool
has(string $location)
Determine if a file or directory exists using the Flysystem operator.
in
InteractsWithPooledFilesystem at line 163
string
read(string $location)
Read a file using the Flysystem operator.
in
InteractsWithPooledFilesystem at line 171
int
fileSize(string $path)
Get a file size using the Flysystem operator.
in
InteractsWithPooledFilesystem at line 179
string
visibility(string $path)
Get raw Flysystem visibility for a path.
in
InteractsWithPooledFilesystem at line 187
void
write(string $location, string $contents, array $config = [])
Write a file using the Flysystem operator.
in
InteractsWithPooledFilesystem at line 195
void
createDirectory(string $location, array $config = [])
Create a directory using the Flysystem operator.
in
InteractsWithPooledFilesystem at line 203
string|null
get(string $path)
Get the contents of a file.
in
InteractsWithPooledFilesystem at line 211
array|bool|float|int|string|null
json(string $path, int $flags = 0)
Get the contents of a file as decoded JSON.
in
InteractsWithPooledFilesystem at line 219
StreamedResponse
response(string $path, string|null $name = null, array $headers = [], string $disposition = 'inline')
Create a streamed response for a given file.
in
InteractsWithPooledFilesystem at line 237
Response
serve(Request $request, string $path, string|null $name = null, array $headers = [])
Create a streamed response for serving a given file.
in
InteractsWithPooledFilesystem at line 247
StreamedResponse
download(string $path, string|null $name = null, array $headers = [])
Create a streamed download response for a given file.
in
InteractsWithPooledFilesystem at line 255
Image
image(string $path)
Create an image instance from a file in storage.
in
InteractsWithPooledFilesystem at line 268
bool|string
put(string $path, mixed $contents, mixed $options = [])
Write the contents of a file.
in
InteractsWithPooledFilesystem at line 276
false|string
putFile(string|File|UploadedFile $path, array|string|File|UploadedFile|null $file = null, mixed $options = [])
Store the uploaded file on the disk.
in
InteractsWithPooledFilesystem at line 287
false|string
putFileAs(string|File|UploadedFile $path, array|string|File|UploadedFile|null $file, array|string|null $name = null, mixed $options = [])
Store the uploaded file on the disk with a given name.
in
InteractsWithPooledFilesystem at line 299
string
getVisibility(string $path)
Get the visibility for the given path.
in
InteractsWithPooledFilesystem at line 307
bool
setVisibility(string $path, string $visibility)
Set the visibility for the given path.
in
InteractsWithPooledFilesystem at line 315
bool
prepend(string $path, string $data, string $separator = PHP_EOL)
Prepend to a file.
in
InteractsWithPooledFilesystem at line 323
bool
append(string $path, string $data, string $separator = PHP_EOL)
Append to a file.
in
InteractsWithPooledFilesystem at line 331
bool
delete(array|string $paths)
Delete the file at a given path.
in
InteractsWithPooledFilesystem at line 339
bool
copy(string $from, string $to)
Copy a file to a new location.
in
InteractsWithPooledFilesystem at line 347
bool
move(string $from, string $to)
Move a file to a new location.
in
InteractsWithPooledFilesystem at line 355
int
size(string $path)
Get the file size of a given file.
in
InteractsWithPooledFilesystem at line 363
false|string
checksum(string $path, array $options = [])
Get the checksum for a file.
in
InteractsWithPooledFilesystem at line 371
false|string
mimeType(string $path)
Get the mime-type of a given file.
in
InteractsWithPooledFilesystem at line 379
int
lastModified(string $path)
Get the file's last modification time.
in
InteractsWithPooledFilesystem at line 389
mixed
readStream(string $path)
Get a resource to read the file.
in
InteractsWithPooledFilesystem at line 401
mixed
readStreamRange(string $path, int|null $start, int|null $end)
Get a resource to read the partial file.
in
InteractsWithPooledFilesystem at line 413
bool
writeStream(string $path, mixed $resource, array $options = [])
Write a new file using a stream.
in
InteractsWithPooledFilesystem at line 421
string
url(string $path)
Get the URL for the file at the given path.
in
InteractsWithPooledFilesystem at line 429
bool
providesTemporaryUrls()
Determine if temporary URLs can be generated.
in
InteractsWithPooledFilesystem at line 437
bool
providesTemporaryUploadUrls()
Determine if temporary upload URLs can be generated.
in
InteractsWithPooledFilesystem at line 445
string
temporaryUrl(string $path, DateTimeInterface $expiration, array $options = [])
Get a temporary URL for the file at the given path.
in
InteractsWithPooledFilesystem at line 453
array|string
temporaryUploadUrl(string $path, DateTimeInterface $expiration, array $options = [])
Get a temporary upload URL for the file at the given path.
in
InteractsWithPooledFilesystem at line 464
array
files(string|null $directory = null, bool $recursive = false)
Get an array of all files in a directory.
in
InteractsWithPooledFilesystem at line 472
array
allFiles(string|null $directory = null)
Get all of the files from the given directory recursively.
in
InteractsWithPooledFilesystem at line 480
array
directories(string|null $directory = null, bool $recursive = false)
Get all of the directories within a given directory.
in
InteractsWithPooledFilesystem at line 488
array
allDirectories(string|null $directory = null)
Get all of the directories within a given directory recursively.
in
InteractsWithPooledFilesystem at line 496
bool
makeDirectory(string $path)
Create a directory.
in
InteractsWithPooledFilesystem at line 504
bool
deleteDirectory(string $directory)
Recursively delete a directory.
in
InteractsWithPooledFilesystem at line 512
never
getDriver()
Reject access to the borrowed Flysystem driver.
in
InteractsWithPooledFilesystem at line 521
never
getAdapter()
Reject access to the borrowed Flysystem adapter.
in
InteractsWithPooledFilesystem at line 530
never
getClient()
Reject access to a borrowed client.
in
InteractsWithPooledFilesystem at line 545
mixed
withDriver(Closure $callback)
Run a callback with borrow-scoped access to the Flysystem driver.
in
InteractsWithPooledFilesystem at line 553
FilesystemOperator
getOperator()
Get an operator that owns each operation's borrow and each stream's lease.
in
InteractsWithPooledFilesystem at line 587
mixed
withAdapter(Closure $callback)
Run a callback with borrow-scoped access to the Flysystem adapter.
in
InteractsWithPooledFilesystem at line 601
mixed
withClient(Closure $callback)
Run a callback with borrow-scoped access to the driver client.
in
InteractsWithPooledFilesystem at line 611
array
getConfig()
Get the disk configuration.
Nested objects remain shared references; the configuration is not deep-copied.
in
InteractsWithPooledFilesystem at line 622
void
serveUsing(Closure|null $callback)
Define a custom callback that generates file download responses.
The callback persists on the manager-cached disk for the worker lifetime and is written to every borrowed adapter.
in
InteractsWithPooledFilesystem at line 634
void
buildTemporaryUrlsUsing(Closure|null $callback)
Define a custom temporary URL builder callback.
The callback persists on the manager-cached disk for the worker lifetime and is written to every borrowed adapter.
in
InteractsWithPooledFilesystem at line 646
void
buildTemporaryUploadUrlsUsing(Closure|null $callback)
Define a custom temporary upload URL builder callback.
The callback persists on the manager-cached disk for the worker lifetime and is written to every borrowed adapter.
at line 66
protected mixed
invoke(string $method, array $parameters)
Invoke a synchronous method against a per-operation stack.
in
InteractsWithPooledFilesystem at line 660
protected void
releaseIdleConnectionsFor(string $method)
Return idle database sessions before operations that can contact a provider.
at line 158
protected mixed
leasedStream(Closure $operation)
Open a stream that retains its client lease while needed.
in
InteractsWithPooledFilesystem at line 681
protected mixed
releaseOrWrapStream(mixed $stream, Lease $lease)
Release buffered reads immediately and retain the lease for live streams.
at line 176
protected mixed
withBorrowedAccessor(string $accessor, Closure $callback)
Run a callback with an accessor result from a per-operation stack.
in
InteractsWithPooledFilesystem at line 713
protected StreamedResponse
buildFileResponse(Request $request, string $path, string|null $name, array $headers, string $disposition)
Build a file response using short borrows and a leased stream.
in
InteractsWithPooledFilesystem at line 739
protected RuntimeException
borrowedInternalsException()
Create the exception used for every rejected borrowed-internal accessor.
in
InteractsWithPooledFilesystem at line 750
never
__call(string $method, array $parameters)
Reject methods that have not been audited for deferred results.
at line 29
__construct(PoolDefinition $definition, Closure $clientFactory, Closure $stackFactory, Factory $pools, array $config, Closure|null $releaseCallback = null)
Create a client-pooled filesystem.
at line 42
PoolDefinition
getDefinition()
Get the pooled client's definition.
at line 50
string
getPoolName()
Return the pool's fully qualified registry name.
at line 58
bool
invalidatePool()
Remove and close the current client pool.
at line 80
protected mixed
withStack(Closure $operation)
Run an operation against a stack built around a borrowed client.
at line 92
protected mixed
withBorrowed(Closure $operation)
Run an operation against a stack and its borrowed client.
at line 112
protected array
leaseStack()
Borrow a client and build its per-operation adapter stack.
at line 127
protected FilesystemAdapter
buildStack(object $client)
Build a disk stack and apply every proxy-held callback.