interface FileManagerInterface (View source)

Defines read-only file access whose failures are reported through one typed filesystem boundary.

Methods

string
read(string $file)

Reads the full contents of a file.

string
int
size(string $file)

Returns the file size in bytes.

int
int
modified(string $file)

Returns the last modification time as a UNIX timestamp.

int
string
hash(string $file, string $algo = 'sha256')

Calculates a file hash using the given algorithm.

string
string
mime(string $file)

Detects the MIME type of a file.

string
int
permissions(string $file)

Returns the file permissions as an octal permission mask.

int

Details

read

string read(string $file)

Reads the full contents of a file.

Parameters

string $file

Return Value

string

Exceptions

FilesystemException

size

int size(string $file)

Returns the file size in bytes.

Parameters

string $file

Return Value

int

Exceptions

FilesystemException

modified

int modified(string $file)

Returns the last modification time as a UNIX timestamp.

Parameters

string $file

Return Value

int

Exceptions

FilesystemException

hash

string hash(string $file, string $algo = 'sha256')

Calculates a file hash using the given algorithm.

Parameters

string $file
string $algo

Return Value

string

Exceptions

FilesystemException

mime

string mime(string $file)

Detects the MIME type of a file.

Parameters

string $file

Return Value

string

Exceptions

FilesystemException

permissions

int permissions(string $file)

Returns the file permissions as an octal permission mask.

Parameters

string $file

Return Value

int

Exceptions

FilesystemException