Filesystem
class Filesystem extends Filesystem
File helper
Properties
string | $filePermissions | ||
string | $folderPermissions | ||
array | $pathSymbols |
Methods
Determine if the given path contains no files.
Converts a file size in bytes to human readable format.
Returns a public file path from an absolute one eg: /home/mysite/public_html/welcome -> /welcome
Returns true if the specified path is an absolute/local path to the application.
Finds the path to a class
Determine if a file exists with case insensitivity supported for the file only.
Normalizes the directory separator, often used by Win systems.
Converts a path using path symbol. Returns the original path if no symbol is used and no default is specified.
Returns true if the path uses a symbol.
Write the contents of a file.
Copy a file to a new location.
Create a directory.
Modify file/folder permissions
Modify file/folder permissions recursively
Returns the default file permission mask to use.
Returns the default folder permission mask to use.
Match filename against a pattern.
Details
at line 36
bool
isDirectoryEmpty(string $directory)
Determine if the given path contains no files.
at line 60
string
sizeToString(int $bytes)
Converts a file size in bytes to human readable format.
at line 91
string
localToPublic(string $path)
Returns a public file path from an absolute one eg: /home/mysite/public_html/welcome -> /welcome
at line 109
bool
isLocalPath(string $path)
Returns true if the specified path is an absolute/local path to the application.
at line 120
string
fromClass(mixed $className)
Finds the path to a class
at line 133
mixed
existsInsensitive(string $path)
Determine if a file exists with case insensitivity supported for the file only.
at line 160
string
normalizePath(string $path)
Normalizes the directory separator, often used by Win systems.
at line 172
string
symbolizePath(string $path, mixed $default = false)
Converts a path using path symbol. Returns the original path if no symbol is used and no default is specified.
at line 188
bool
isPathSymbol(string $path)
Returns true if the path uses a symbol.
at line 205
int
put(string $path, string $contents, bool $lock = false)
Write the contents of a file.
at line 219
bool
copy(string $path, string $target)
Copy a file to a new location.
at line 235
bool
makeDirectory(string $path, int $mode = 0777, bool $recursive = false, bool $force = false)
Create a directory.
at line 281
void
chmod(string $path, int|null $mask = null)
Modify file/folder permissions
at line 303
void
chmodRecursive(string $path, string|null $fileMask = null, string|null $directoryMask = null)
Modify file/folder permissions recursively
at line 339
string
getFilePermissions()
Returns the default file permission mask to use.
at line 350
string
getFolderPermissions()
Returns the default folder permission mask to use.
at line 363
bool
fileNameMatch(string|array $fileName, string $pattern)
Match filename against a pattern.