Cecil

File

File utility class.

This class provides various utility methods for file handling, including reading file contents, getting media types and extensions, reading EXIF data, and checking if files are remote.

Table of Contents

Properties

$fs  : Filesystem

Methods

fileGetContents()  : string|false
file_get_contents() function with error handler.
getExtension()  : string
Returns the extension of a file.
getFS()  : Filesystem
Returns a Symfony\Component\Filesystem instance.
getMediaType()  : array<string|int, mixed>
Returns the media type and subtype of a file.
getRealPath()  : string
Returns the real path of a relative file path.
isRemote()  : bool
Tests if a file path is remote.
isRemoteExists()  : bool
Tests if a remote file exists.
readExif()  : array<string|int, mixed>
exif_read_data() function with error handler.

Properties

$fs

protected static Filesystem $fs

Methods

fileGetContents()

file_get_contents() function with error handler.

public static fileGetContents(string $filename[, string|null $userAgent = null ]) : string|false
Parameters
$filename : string
$userAgent : string|null = null
Return values
string|false

getExtension()

Returns the extension of a file.

public static getExtension(string $filename) : string
Parameters
$filename : string
Return values
string

getFS()

Returns a Symfony\Component\Filesystem instance.

public static getFS() : Filesystem
Return values
Filesystem

getMediaType()

Returns the media type and subtype of a file.

public static getMediaType(string $filename) : array<string|int, mixed>

ie: ['text', 'text/plain']

Parameters
$filename : string
Return values
array<string|int, mixed>

getRealPath()

Returns the real path of a relative file path.

public static getRealPath(string $path) : string
Parameters
$path : string
Return values
string

isRemote()

Tests if a file path is remote.

public static isRemote(string $path) : bool
Parameters
$path : string
Return values
bool

isRemoteExists()

Tests if a remote file exists.

public static isRemoteExists(string $path) : bool
Parameters
$path : string
Return values
bool

readExif()

exif_read_data() function with error handler.

public static readExif(string $filename) : array<string|int, mixed>
Parameters
$filename : string
Return values
array<string|int, mixed>
 
On this page

Search results