class DiskFilesystemService implements FilesystemInterface (View source)

Methods

__construct(string $base_directory)

MountFilesystem constructor.

string
getBaseDirectory()

Get the base directory

array|bool
store(UploadFile $file, string|null $location = null, array $option = [])

Function to upload a file

bool
put(string $file, string $content)

Put other file content in given file

bool
append(string $file, string $content)

Add content after the contents of the file

bool
prepend(string $file, string $content)

Add content before the contents of the file

bool
delete(string $file)

Delete file or directory

array
files(string $dirname)

List the files of a folder passed as a parameter

array
directories(string $dirname)

List the folder of a folder passed as a parameter

bool
makeDirectory(string $dirname, int $mode = 0777)

Create a directory

string|null
get(string $filename)

Recover the contents of the file

bool
copy(string $target, string $source)

Copy the contents of a source file to a target file.

bool
move(string $target, string $source)

Renames or moves a source file to a target file.

bool
exists(string $filename)

Check the existence of a file or directory

string|null
extension(string $filename)

The file extension

bool
isFile(string $filename)

isFile alias of is_file.

bool
isDirectory(string $dirname)

isDirectory alias of is_dir.

string
path(string $filename)

Resolves file path.

Details

__construct(string $base_directory)

MountFilesystem constructor.

Parameters

string $base_directory

string getBaseDirectory()

Get the base directory

Return Value

string

array|bool store(UploadFile $file, string|null $location = null, array $option = [])

Function to upload a file

Parameters

UploadFile $file
string|null $location
array $option

Return Value

array|bool

Exceptions

InvalidArgumentException

bool put(string $file, string $content)

Put other file content in given file

Parameters

string $file
string $content

Return Value

bool

bool append(string $file, string $content)

Add content after the contents of the file

Parameters

string $file
string $content

Return Value

bool

bool prepend(string $file, string $content)

Add content before the contents of the file

Parameters

string $file
string $content

Return Value

bool

Exceptions

bool delete(string $file)

Delete file or directory

Parameters

string $file

Return Value

bool

array files(string $dirname)

List the files of a folder passed as a parameter

Parameters

string $dirname

Return Value

array

array directories(string $dirname)

List the folder of a folder passed as a parameter

Parameters

string $dirname

Return Value

array

bool makeDirectory(string $dirname, int $mode = 0777)

Create a directory

Parameters

string $dirname
int $mode

Return Value

bool

string|null get(string $filename)

Recover the contents of the file

Parameters

string $filename

Return Value

string|null

bool copy(string $target, string $source)

Copy the contents of a source file to a target file.

Parameters

string $target
string $source

Return Value

bool

bool move(string $target, string $source)

Renames or moves a source file to a target file.

Parameters

string $target
string $source

Return Value

bool

bool exists(string $filename)

Check the existence of a file or directory

Parameters

string $filename

Return Value

bool

string|null extension(string $filename)

The file extension

Parameters

string $filename

Return Value

string|null

bool isFile(string $filename)

isFile alias of is_file.

Parameters

string $filename

Return Value

bool

bool isDirectory(string $dirname)

isDirectory alias of is_dir.

Parameters

string $dirname

Return Value

bool

string path(string $filename)

Resolves file path.

Give the absolute path of a path

Parameters

string $filename

Return Value

string