FileSystem
class FileSystem
File system.
Methods
Returns TRUE if a file exists and FALSE if not.
Returns TRUE if the provided path is a file and FALSE if not.
Returns TRUE if the provided path is a directory and FALSE if not.
Returns TRUE if a file or directory is empty and FALSE if not.
Returns TRUE if the file is readable and FALSE if not.
Returns TRUE if the file or directory is writable and FALSE if not.
Returns the time (unix timestamp) the file was last modified.
Returns the fize of the file in bytes.
Returns the extension of the file.
Renames a file or directory.
Deletes the file from disk.
Deletes a directory and its contents from disk.
Returns an array of pathnames matching the provided pattern.
Returns the contents of the file.
Writes the supplied data to a file.
Prepends the supplied data to a file.
Appends the supplied data to a file.
Truncates a file.
Creates a directory.
Includes a file.
Includes a file it hasn't already been included.
Requires a file.
Requires a file if it hasn't already been required.
Generate a hash value using the contents of the given file.
Generate a keyed hash value using the HMAC method.
Returns a SplFileObject.
Details
at line 42
bool
has(string $file)
Returns TRUE if a file exists and FALSE if not.
at line 53
bool
isFile(string $file)
Returns TRUE if the provided path is a file and FALSE if not.
at line 64
bool
isDirectory(string $directory)
Returns TRUE if the provided path is a directory and FALSE if not.
at line 75
bool
isEmpty(string $path)
Returns TRUE if a file or directory is empty and FALSE if not.
at line 91
bool
isReadable(string $file)
Returns TRUE if the file is readable and FALSE if not.
at line 102
bool
isWritable(string $file)
Returns TRUE if the file or directory is writable and FALSE if not.
at line 113
int
lastModified(string $file)
Returns the time (unix timestamp) the file was last modified.
at line 124
int
size(string $file)
Returns the fize of the file in bytes.
at line 135
string
extension(string $file)
Returns the extension of the file.
at line 148
string|bool
mime(string $file)
deprecated
deprecated
Returns the mime type of the file.
at line 160
bool
rename(string $oldName, string $newName)
Renames a file or directory.
at line 171
bool
remove(string $file)
Deletes the file from disk.
at line 182
bool
removeDirectory(string $path)
Deletes a directory and its contents from disk.
at line 206
array|false
glob(string $pattern, int $flags = 0)
Returns an array of pathnames matching the provided pattern.
at line 217
string|bool
get(string $file)
Returns the contents of the file.
at line 230
static int|bool
put(string $file, mixed $data, bool $lock = false)
Writes the supplied data to a file.
at line 243
static int|bool
prepend(string $file, mixed $data, bool $lock = false)
Prepends the supplied data to a file.
at line 256
static int|bool
append(string $file, mixed $data, bool $lock = false)
Appends the supplied data to a file.
at line 268
static bool
truncate(string $file, bool $lock = false)
Truncates a file.
at line 281
bool
createDirectory(string $path, int $mode = 0777, bool $recursive = false)
Creates a directory.
at line 292
mixed
include(string $file)
Includes a file.
at line 303
mixed
includeOnce(string $file)
Includes a file it hasn't already been included.
at line 314
mixed
require(string $file)
Requires a file.
at line 325
mixed
requireOnce(string $file)
Requires a file if it hasn't already been required.
at line 340
string
hash(string $file, string $algorithm = 'sha256', bool $raw = false)
deprecated
deprecated
Generate a hash value using the contents of the given file.
at line 356
string
hmac(string $file, string $key, string $algorithm = 'sha256', bool $raw = false)
deprecated
deprecated
Generate a keyed hash value using the HMAC method.
at line 367
FileInfo
info(string $file)
Returns a FileInfo object.
at line 380
SplFileObject
file(string $file, string $openMode = 'r', bool $useIncludePath = false)
Returns a SplFileObject.