FilesystemAdapter
class FilesystemAdapter implements Cloud (View source)
Properties
protected FilesystemInterface | $driver | The Flysystem filesystem implementation. |
Methods
void | __construct(FilesystemInterface $driver) Create a new filesystem adapter instance. | |
$this | assertExists(string|array $path) Assert that the given file exists. | |
$this | assertMissing(string|array $path) Assert that the given file does not exist. | |
bool | exists(string $path) Determine if a file exists. | |
bool | missing(string $path) Determine if a file or directory is missing. | |
string | path(string $path) Get the full path for the file at the given "short" path. | |
string | get(string $path) Get the contents of a file. | |
StreamedResponse | response(string $path, string|null $name = null, array $headers = [], string|null $disposition = 'inline') Create a streamed response for a given file. | |
StreamedResponse | download(string $path, string|null $name = null, array $headers = []) Create a streamed download response for a given file. | |
string | fallbackName(string $name) Convert the string to ASCII characters that are equivalent to the given name. | |
bool | put(string $path, string|resource $contents, mixed $options = []) Write the contents of a file. | |
string|false | putFile(string $path, File|UploadedFile|string $file, mixed $options = []) Store the uploaded file on the disk. | |
string|false | putFileAs(string $path, File|UploadedFile|string $file, string $name, mixed $options = []) Store the uploaded file on the disk with a given name. | |
string | getVisibility(string $path) Get the visibility for the given path. | |
bool | setVisibility(string $path, string $visibility) Set the visibility for the given path. | |
bool | prepend(string $path, string $data, string $separator = PHP_EOL) Prepend to a file. | |
bool | append(string $path, string $data, string $separator = PHP_EOL) Append to a file. | |
bool | delete(string|array $paths) Delete the file at a given path. | |
bool | copy(string $from, string $to) Copy a file to a new location. | |
bool | move(string $from, string $to) Move a file to a new location. | |
int | size(string $path) Get the file size of a given file. | |
string|false | mimeType(string $path) Get the mime-type of a given file. | |
int | lastModified(string $path) Get the file's last modification time. | |
string | url(string $path) Get the URL for the file at the given path. | |
resource|null | readStream(string $path) Get a resource to read the file. | |
bool | writeStream(string $path, resource $resource, array $options = []) Write a new file using a stream. | |
string | getAwsUrl(AwsS3Adapter $adapter, string $path) Get the URL for the file at the given path. | |
string | getFtpUrl(string $path) Get the URL for the file at the given path. | |
string | getLocalUrl(string $path) Get the URL for the file at the given path. | |
string | temporaryUrl(string $path, DateTimeInterface $expiration, array $options = []) Get a temporary URL for the file at the given path. | |
string | getAwsTemporaryUrl(AwsS3Adapter $adapter, string $path, DateTimeInterface $expiration, array $options) Get a temporary URL for the file at the given path. | |
string | concatPathToUrl(string $url, string $path) Concatenate a path to a URL. | |
array | files(string|null $directory = null, bool $recursive = false) Get an array of all files in a directory. | |
array | allFiles(string|null $directory = null) Get all of the files from the given directory (recursive). | |
array | directories(string|null $directory = null, bool $recursive = false) Get all of the directories within a given directory. | |
array | allDirectories(string|null $directory = null) Get all (recursive) of the directories within a given directory. | |
bool | makeDirectory(string $path) Create a directory. | |
bool | deleteDirectory(string $directory) Recursively delete a directory. | |
void | flushCache() Flush the Flysystem cache. | |
FilesystemInterface | getDriver() Get the Flysystem driver. | |
array | filterContentsByType(array $contents, string $type) Filter directory contents by type. | |
string|null | parseVisibility(string|null $visibility) Parse the given visibility value. | |
mixed | __call(string $method, array $parameters) Pass dynamic methods call onto Flysystem. |
Details
void __construct(FilesystemInterface $driver)
Create a new filesystem adapter instance.
$this assertExists(string|array $path)
Assert that the given file exists.
$this assertMissing(string|array $path)
Assert that the given file does not exist.
bool exists(string $path)
Determine if a file exists.
bool missing(string $path)
Determine if a file or directory is missing.
string path(string $path)
Get the full path for the file at the given "short" path.
string get(string $path)
Get the contents of a file.
StreamedResponse response(string $path, string|null $name = null, array $headers = [], string|null $disposition = 'inline')
Create a streamed 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, string|resource $contents, mixed $options = [])
Write the contents of a file.
string|false putFile(string $path, File|UploadedFile|string $file, mixed $options = [])
Store the uploaded file on the disk.
string|false putFileAs(string $path, File|UploadedFile|string $file, string $name, mixed $options = [])
Store the uploaded file on the disk with a given name.
string getVisibility(string $path)
Get the visibility for the given path.
bool setVisibility(string $path, string $visibility)
Set the visibility for the given path.
bool prepend(string $path, string $data, string $separator = PHP_EOL)
Prepend to a file.
bool append(string $path, string $data, string $separator = PHP_EOL)
Append to a file.
bool delete(string|array $paths)
Delete the file at a given path.
bool copy(string $from, string $to)
Copy a file to a new location.
bool move(string $from, string $to)
Move a file to a new location.
int size(string $path)
Get the file size of a given file.
string|false mimeType(string $path)
Get the mime-type of a given file.
int lastModified(string $path)
Get the file's last modification time.
string url(string $path)
Get the URL for the file at the given path.
resource|null readStream(string $path)
Get a resource to read the file.
bool writeStream(string $path, resource $resource, array $options = [])
Write a new file using a stream.
protected string getAwsUrl(AwsS3Adapter $adapter, string $path)
Get the URL for the file at the given path.
protected string getFtpUrl(string $path)
Get the URL for the file at the given path.
protected string getLocalUrl(string $path)
Get the URL for the file at the given path.
string temporaryUrl(string $path, DateTimeInterface $expiration, array $options = [])
Get a temporary URL for the file at the given path.
string getAwsTemporaryUrl(AwsS3Adapter $adapter, string $path, DateTimeInterface $expiration, array $options)
Get a temporary URL for the file at the given path.
protected string concatPathToUrl(string $url, string $path)
Concatenate a path to a URL.
array files(string|null $directory = null, bool $recursive = false)
Get an array of all files in a directory.
array allFiles(string|null $directory = null)
Get all of the files from the given directory (recursive).
array directories(string|null $directory = null, bool $recursive = false)
Get all of the directories within a given directory.
array allDirectories(string|null $directory = null)
Get all (recursive) of the directories within a given directory.
bool makeDirectory(string $path)
Create a directory.
bool deleteDirectory(string $directory)
Recursively delete a directory.
void flushCache()
Flush the Flysystem cache.
FilesystemInterface getDriver()
Get the Flysystem driver.
protected array filterContentsByType(array $contents, string $type)
Filter directory contents by type.
protected string|null parseVisibility(string|null $visibility)
Parse the given visibility value.
mixed __call(string $method, array $parameters)
Pass dynamic methods call onto Flysystem.
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/6.x/Illuminate/Filesystem/FilesystemAdapter.html