Filesystem
in package
Uses
Macroable
Table of Contents
- $macros : array<string|int, mixed>
- The registered string macros.
- __call() : mixed
- Dynamically handle calls to the class.
- __callStatic() : mixed
- Dynamically handle calls to the class.
- allFiles() : array<string|int, SplFileInfo>
- Get all of the files from the given directory (recursive).
- append() : int
- Append to a file.
- basename() : string
- Extract the trailing name component from a file path.
- chmod() : mixed
- Get or set UNIX mode of a file or directory.
- cleanDirectory() : bool
- Empty the specified directory of all files and folders.
- copy() : bool
- Copy a file to a new location.
- copyDirectory() : bool
- Copy a directory from one location to another.
- delete() : bool
- Delete the file at a given path.
- deleteDirectory() : bool
- Recursively delete a directory.
- directories() : array<string|int, mixed>
- Get all of the directories within a given directory.
- dirname() : string
- Extract the parent directory from a file path.
- exists() : bool
- Determine if a file or directory exists.
- extension() : string
- Extract the file extension from a file path.
- files() : array<string|int, SplFileInfo>
- Get an array of all files in a directory.
- get() : string
- Get the contents of a file.
- getRequire() : mixed
- Get the returned value of a file.
- glob() : array<string|int, mixed>
- Find path names matching a given pattern.
- hash() : string
- Get the MD5 hash of the file at the given path.
- hasMacro() : bool
- Checks if macro is registered.
- isDirectory() : bool
- Determine if the given path is a directory.
- isFile() : bool
- Determine if the given path is a file.
- isReadable() : bool
- Determine if the given path is readable.
- isWritable() : bool
- Determine if the given path is writable.
- lastModified() : int
- Get the file's last modification time.
- link() : void
- Create a hard link to the target file or directory.
- macro() : void
- Register a custom macro.
- makeDirectory() : bool
- Create a directory.
- mimeType() : string|false
- Get the mime-type of a given file.
- mixin() : void
- Mix another object into the class.
- move() : bool
- Move a file to a new location.
- moveDirectory() : bool
- Move a directory.
- name() : string
- Extract the file name from a file path.
- prepend() : int
- Prepend to a file.
- put() : int
- Write the contents of a file.
- requireOnce() : mixed
- Require the given file once.
- sharedGet() : string
- Get contents of a file with shared access.
- size() : int
- Get the file size of a given file.
- type() : string
- Get the file type of a given file.
Properties
$macros
The registered string macros.
protected
static array<string|int, mixed>
$macros
= []
Methods
__call()
Dynamically handle calls to the class.
public
__call(string $method, array<string|int, mixed> $parameters) : mixed
Parameters
- $method : string
- $parameters : array<string|int, mixed>
Tags
Return values
mixed —__callStatic()
Dynamically handle calls to the class.
public
static __callStatic(string $method, array<string|int, mixed> $parameters) : mixed
Parameters
- $method : string
- $parameters : array<string|int, mixed>
Tags
Return values
mixed —allFiles()
Get all of the files from the given directory (recursive).
public
allFiles(string $directory[, bool $hidden = false ]) : array<string|int, SplFileInfo>
Parameters
- $directory : string
- $hidden : bool = false
Return values
array<string|int, SplFileInfo> —append()
Append to a file.
public
append(string $path, string $data) : int
Parameters
- $path : string
- $data : string
Return values
int —basename()
Extract the trailing name component from a file path.
public
basename(string $path) : string
Parameters
- $path : string
Return values
string —chmod()
Get or set UNIX mode of a file or directory.
public
chmod(string $path[, int $mode = null ]) : mixed
Parameters
- $path : string
- $mode : int = null
Return values
mixed —cleanDirectory()
Empty the specified directory of all files and folders.
public
cleanDirectory(string $directory) : bool
Parameters
- $directory : string
Return values
bool —copy()
Copy a file to a new location.
public
copy(string $path, string $target) : bool
Parameters
- $path : string
- $target : string
Return values
bool —copyDirectory()
Copy a directory from one location to another.
public
copyDirectory(string $directory, string $destination[, int $options = null ]) : bool
Parameters
- $directory : string
- $destination : string
- $options : int = null
Return values
bool —delete()
Delete the file at a given path.
public
delete(string|array<string|int, mixed> $paths) : bool
Parameters
- $paths : string|array<string|int, mixed>
Return values
bool —deleteDirectory()
Recursively delete a directory.
public
deleteDirectory(string $directory[, bool $preserve = false ]) : bool
The directory itself may be optionally preserved.
Parameters
- $directory : string
- $preserve : bool = false
Return values
bool —directories()
Get all of the directories within a given directory.
public
directories(string $directory) : array<string|int, mixed>
Parameters
- $directory : string
Return values
array<string|int, mixed> —dirname()
Extract the parent directory from a file path.
public
dirname(string $path) : string
Parameters
- $path : string
Return values
string —exists()
Determine if a file or directory exists.
public
exists(string $path) : bool
Parameters
- $path : string
Return values
bool —extension()
Extract the file extension from a file path.
public
extension(string $path) : string
Parameters
- $path : string
Return values
string —files()
Get an array of all files in a directory.
public
files(string $directory[, bool $hidden = false ]) : array<string|int, SplFileInfo>
Parameters
- $directory : string
- $hidden : bool = false
Return values
array<string|int, SplFileInfo> —get()
Get the contents of a file.
public
get(string $path[, bool $lock = false ]) : string
Parameters
- $path : string
- $lock : bool = false
Tags
Return values
string —getRequire()
Get the returned value of a file.
public
getRequire(string $path) : mixed
Parameters
- $path : string
Tags
Return values
mixed —glob()
Find path names matching a given pattern.
public
glob(string $pattern, int $flags) : array<string|int, mixed>
Parameters
- $pattern : string
- $flags : int
Return values
array<string|int, mixed> —hash()
Get the MD5 hash of the file at the given path.
public
hash(string $path) : string
Parameters
- $path : string
Return values
string —hasMacro()
Checks if macro is registered.
public
static hasMacro(string $name) : bool
Parameters
- $name : string
Return values
bool —isDirectory()
Determine if the given path is a directory.
public
isDirectory(string $directory) : bool
Parameters
- $directory : string
Return values
bool —isFile()
Determine if the given path is a file.
public
isFile(string $file) : bool
Parameters
- $file : string
Return values
bool —isReadable()
Determine if the given path is readable.
public
isReadable(string $path) : bool
Parameters
- $path : string
Return values
bool —isWritable()
Determine if the given path is writable.
public
isWritable(string $path) : bool
Parameters
- $path : string
Return values
bool —lastModified()
Get the file's last modification time.
public
lastModified(string $path) : int
Parameters
- $path : string
Return values
int —link()
Create a hard link to the target file or directory.
public
link(string $target, string $link) : void
Parameters
- $target : string
- $link : string
Return values
void —macro()
Register a custom macro.
public
static macro(string $name, object|callable $macro) : void
Parameters
- $name : string
- $macro : object|callable
Return values
void —makeDirectory()
Create a directory.
public
makeDirectory(string $path[, int $mode = 0755 ][, bool $recursive = false ][, bool $force = false ]) : bool
Parameters
- $path : string
- $mode : int = 0755
- $recursive : bool = false
- $force : bool = false
Return values
bool —mimeType()
Get the mime-type of a given file.
public
mimeType(string $path) : string|false
Parameters
- $path : string
Return values
string|false —mixin()
Mix another object into the class.
public
static mixin(object $mixin) : void
Parameters
- $mixin : object
Return values
void —move()
Move a file to a new location.
public
move(string $path, string $target) : bool
Parameters
- $path : string
- $target : string
Return values
bool —moveDirectory()
Move a directory.
public
moveDirectory(string $from, string $to[, bool $overwrite = false ]) : bool
Parameters
- $from : string
- $to : string
- $overwrite : bool = false
Return values
bool —name()
Extract the file name from a file path.
public
name(string $path) : string
Parameters
- $path : string
Return values
string —prepend()
Prepend to a file.
public
prepend(string $path, string $data) : int
Parameters
- $path : string
- $data : string
Return values
int —put()
Write the contents of a file.
public
put(string $path, string $contents[, bool $lock = false ]) : int
Parameters
- $path : string
- $contents : string
- $lock : bool = false
Return values
int —requireOnce()
Require the given file once.
public
requireOnce(string $file) : mixed
Parameters
- $file : string
Return values
mixed —sharedGet()
Get contents of a file with shared access.
public
sharedGet(string $path) : string
Parameters
- $path : string
Return values
string —size()
Get the file size of a given file.
public
size(string $path) : int
Parameters
- $path : string
Return values
int —type()
Get the file type of a given file.
public
type(string $path) : string
Parameters
- $path : string