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.
Returns the total size of a filesystem or disk partition in bytes.
Returns the total number of available bytes on the filesystem or disk partition.
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 44
bool
has(string $file)
Returns TRUE if a file exists and FALSE if not.
at line 55
bool
isFile(string $file)
Returns TRUE if the provided path is a file and FALSE if not.
at line 66
bool
isDirectory(string $directory)
Returns TRUE if the provided path is a directory and FALSE if not.
at line 77
bool
isEmpty(string $path)
Returns TRUE if a file or directory is empty and FALSE if not.
at line 93
bool
isReadable(string $file)
Returns TRUE if the file is readable and FALSE if not.
at line 104
bool
isWritable(string $file)
Returns TRUE if the file or directory is writable and FALSE if not.
at line 115
int
lastModified(string $file)
Returns the time (unix timestamp) the file was last modified.
at line 126
int
size(string $file)
Returns the fize of the file in bytes.
at line 137
string
extension(string $file)
Returns the extension of the file.
at line 149
bool
rename(string $oldName, string $newName)
Renames a file or directory.
at line 160
bool
remove(string $file)
Deletes the file from disk.
at line 171
bool
removeDirectory(string $path)
Deletes a directory and its contents from disk.
at line 195
array|false
glob(string $pattern, int $flags = 0)
Returns an array of pathnames matching the provided pattern.
at line 206
false|string
get(string $file)
Returns the contents of the file.
at line 219
static false|int
put(string $file, mixed $data, bool $lock = false)
Writes the supplied data to a file.
at line 232
static false|int
prepend(string $file, mixed $data, bool $lock = false)
Prepends the supplied data to a file.
at line 245
static false|int
append(string $file, mixed $data, bool $lock = false)
Appends the supplied data to a file.
at line 257
static bool
truncate(string $file, bool $lock = false)
Truncates a file.
at line 270
bool
createDirectory(string $path, int $mode = 0777, bool $recursive = false)
Creates a directory.
at line 281
float
getDiskSize(string|null $directory = null)
Returns the total size of a filesystem or disk partition in bytes.
at line 292
float
getFreeSpaceOnDisk(string|null $directory = null)
Returns the total number of available bytes on the filesystem or disk partition.
at line 303
mixed
include(string $file)
Includes a file.
at line 314
mixed
includeOnce(string $file)
Includes a file it hasn't already been included.
at line 325
mixed
require(string $file)
Requires a file.
at line 336
mixed
requireOnce(string $file)
Requires a file if it hasn't already been required.
at line 347
FileInfo
info(string $file)
Returns a FileInfo object.
at line 360
SplFileObject
file(string $file, string $openMode = 'r', bool $useIncludePath = false)
Returns a SplFileObject.