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 46
bool
has(string $file)
Returns TRUE if a file exists and FALSE if not.
at line 57
bool
isFile(string $file)
Returns TRUE if the provided path is a file and FALSE if not.
at line 68
bool
isDirectory(string $directory)
Returns TRUE if the provided path is a directory and FALSE if not.
at line 79
bool
isEmpty(string $path)
Returns TRUE if a file or directory is empty and FALSE if not.
at line 95
bool
isReadable(string $file)
Returns TRUE if the file is readable and FALSE if not.
at line 106
bool
isWritable(string $file)
Returns TRUE if the file or directory is writable and FALSE if not.
at line 117
int
lastModified(string $file)
Returns the time (unix timestamp) the file was last modified.
at line 128
int
size(string $file)
Returns the fize of the file in bytes.
at line 139
string
extension(string $file)
Returns the extension of the file.
at line 151
bool
rename(string $oldName, string $newName)
Renames a file or directory.
at line 162
bool
remove(string $file)
Deletes the file from disk.
at line 173
bool
removeDirectory(string $path)
Deletes a directory and its contents from disk.
at line 197
array|false
glob(string $pattern, int $flags = 0)
Returns an array of pathnames matching the provided pattern.
at line 208
string|bool
get(string $file)
Returns the contents of the file.
at line 221
static int|bool
put(string $file, mixed $data, bool $lock = false)
Writes the supplied data to a file.
at line 234
static int|bool
prepend(string $file, mixed $data, bool $lock = false)
Prepends the supplied data to a file.
at line 247
static int|bool
append(string $file, mixed $data, bool $lock = false)
Appends the supplied data to a file.
at line 259
static bool
truncate(string $file, bool $lock = false)
Truncates a file.
at line 272
bool
createDirectory(string $path, int $mode = 0777, bool $recursive = false)
Creates a directory.
at line 283
float
getDiskSize(string|null $directory = null)
Returns the total size of a filesystem or disk partition in bytes.
at line 294
float
getFreeSpaceOnDisk(string|null $directory = null)
Returns the total number of available bytes on the filesystem or disk partition.
at line 305
mixed
include(string $file)
Includes a file.
at line 316
mixed
includeOnce(string $file)
Includes a file it hasn't already been included.
at line 327
mixed
require(string $file)
Requires a file.
at line 338
mixed
requireOnce(string $file)
Requires a file if it hasn't already been required.
at line 349
FileInfo
info(string $file)
Returns a FileInfo object.
at line 362
SplFileObject
file(string $file, string $openMode = 'r', bool $useIncludePath = false)
Returns a SplFileObject.