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.
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 147
bool
rename(string $oldName, string $newName)
Renames a file or directory.
at line 158
bool
remove(string $file)
Deletes the file from disk.
at line 169
bool
removeDirectory(string $path)
Deletes a directory and its contents from disk.
at line 193
array|false
glob(string $pattern, int $flags = 0)
Returns an array of pathnames matching the provided pattern.
at line 204
string|bool
get(string $file)
Returns the contents of the file.
at line 217
static int|bool
put(string $file, mixed $data, bool $lock = false)
Writes the supplied data to a file.
at line 230
static int|bool
prepend(string $file, mixed $data, bool $lock = false)
Prepends the supplied data to a file.
at line 243
static int|bool
append(string $file, mixed $data, bool $lock = false)
Appends the supplied data to a file.
at line 255
static bool
truncate(string $file, bool $lock = false)
Truncates a file.
at line 268
bool
createDirectory(string $path, int $mode = 0777, bool $recursive = false)
Creates a directory.
at line 279
mixed
include(string $file)
Includes a file.
at line 290
mixed
includeOnce(string $file)
Includes a file it hasn't already been included.
at line 301
mixed
require(string $file)
Requires a file.
at line 312
mixed
requireOnce(string $file)
Requires a file if it hasn't already been required.
at line 323
FileInfo
info(string $file)
Returns a FileInfo object.
at line 336
SplFileObject
file(string $file, string $openMode = 'r', bool $useIncludePath = false)
Returns a SplFileObject.