LocalFilesystemAdapter
class LocalFilesystemAdapter extends FilesystemAdapter (View source)
Traits
Properties
static protected array | $macros | The registered string macros. |
from Macroable |
protected FilesystemOperator | $driver | The Flysystem filesystem implementation. |
from FilesystemAdapter |
protected FilesystemAdapter | $adapter | The Flysystem adapter implementation. |
from FilesystemAdapter |
protected array | $config | The filesystem configuration. |
from FilesystemAdapter |
protected PathPrefixer | $prefixer | The Flysystem PathPrefixer instance. |
from FilesystemAdapter |
protected Closure|null | $serveCallback | The file server callback. |
from FilesystemAdapter |
protected Closure|null | $temporaryUrlCallback | The temporary URL builder callback. |
from FilesystemAdapter |
protected string | $disk | The name of the filesystem disk. |
|
protected bool | $shouldServeSignedUrls | Indicates if signed URLs should serve corresponding files. |
|
protected Closure | $urlGeneratorResolver | The Closure that should be used to resolve the URL generator. |
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.
Mix another object into the class.
Dynamically handle calls to the class.
Dynamically handle calls to the class.
Create a new filesystem adapter instance.
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.
Get the full path to the file that exists at the given relative path.
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 a streamed download response for a given file.
Convert the string to ASCII characters that are equivalent to the given name.
Write the contents of a file.
Store the uploaded file on the disk.
Store the uploaded file on the disk with a given name.
Set the visibility for the given path.
Prepend to a file.
Append to a file.
Get the checksum for a file.
Write a new file using a stream.
Determine if temporary 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.
Concatenate a path to a URL.
Replace the scheme, host and port of the given UriInterface with values from the given URL.
Get an array of all files in a directory.
Get all of the files from the given directory (recursive).
Get all of the directories within a given directory.
Get all the directories within a given directory (recursive).
Parse the given visibility value.
Specify the name of the disk the adapter is managing.
Indicate that signed URLs should serve the corresponding files.
Details
$this|TWhenReturnType
when($value = null, callable|null $callback = null, callable|null $default = null)
Apply the callback if the given "value" is (or resolves to) truthy.
$this|TUnlessReturnType
unless($value = null, callable|null $callback = null, callable|null $default = null)
Apply the callback if the given "value" is (or resolves to) falsy.
__construct(FilesystemOperator $driver, FilesystemAdapter $adapter, array $config = [])
Create a new filesystem adapter instance.
$this
assertExists(string|array $path, string|null $content = null)
Assert that the given file or directory exists.
$this
assertCount(string $path, int $count, bool $recursive = false)
Assert that the number of files in path equals the expected count.
StreamedResponse
response(string $path, string|null $name = null, array $headers = [], string|null $disposition = 'inline')
Create a streamed response for a given file.
StreamedResponse
serve(Request $request, string $path, string|null $name = null, array $headers = [])
Create a streamed download response for a given file.
StreamedResponse
download(string $path, string|null $name = null, array $headers = [])
Create a streamed download response for a given file.
protected string
fallbackName(string $name)
Convert the string to ASCII characters that are equivalent to the given name.
bool
put(string $path, StreamInterface|File|UploadedFile|string|resource $contents, mixed $options = [])
Write the contents of a file.
string|false
putFile(File|UploadedFile|string $path, File|UploadedFile|string|array|null $file = null, mixed $options = [])
Store the uploaded file on the disk.
string|false
putFileAs(File|UploadedFile|string $path, File|UploadedFile|string|array|null $file, string|array|null $name = null, mixed $options = [])
Store the uploaded file on the disk with a given name.
bool
writeStream(string $path, resource $resource, array $options = [])
Write a new file using a stream.
string
temporaryUrl(string $path, DateTimeInterface $expiration, array $options = [])
Get a temporary URL for the file at the given path.
array
temporaryUploadUrl(string $path, DateTimeInterface $expiration, array $options = [])
Get a temporary upload URL for the file at the given path.
protected UriInterface
replaceBaseUrl(UriInterface $uri, string $url)
Replace the scheme, host and port of the given UriInterface with values from the given URL.
string[]
files(string|null $directory = null, bool $recursive = false)
Get an array of all files in a directory.
string[]
allFiles(string|null $directory = null)
Get all of the files from the given directory (recursive).
string[]
directories(string|null $directory = null, bool $recursive = false)
Get all of the directories within a given directory.
string[]
allDirectories(string|null $directory = null)
Get all the directories within a given directory (recursive).
$this
shouldServeSignedUrls(bool $serve = true, Closure|null $urlGeneratorResolver = null)
Indicate that signed URLs should serve the corresponding files.