Methods |
public
|
exists(string $path): bool
Determine if a file or directory exists.
Determine if a file or directory exists.
|
#
|
public
|
missing(string $path): bool
Determine if a file or directory is missing.
Determine if a file or directory is missing.
|
#
|
public
|
get(string $path, bool $lock = false): string
Get the contents of a file.
Get the contents of a file.
Throws
|
#
|
public
|
sharedGet(string $path): string
Get contents of a file with shared access.
Get contents of a file with shared access.
|
#
|
public
|
getRequire(string $path, array $data = []): mixed
Get the returned value of a file.
Get the returned value of a file.
Throws
|
#
|
public
|
requireOnce(string $path, array $data = []): mixed
Require the given file once.
Require the given file once.
Throws
|
#
|
public
|
lines(string $path): LazyCollection
Get the contents of a file one line at a time.
Get the contents of a file one line at a time.
Throws
|
#
|
public
|
hash(string $path): string
Get the MD5 hash of the file at the given path.
Get the MD5 hash of the file at the given path.
|
#
|
public
|
put(string $path, string $contents, bool $lock = false): int|bool
Write the contents of a file.
Write the contents of a file.
|
#
|
public
|
replace(string $path, string $content): void
Write the contents of a file, replacing it atomically if it already exists.
Write the contents of a file, replacing it atomically if it already exists.
|
#
|
public
|
replaceInFile(array|string $search, array|string $replace, string $path): void
Replace a given string within a given file.
Replace a given string within a given file.
|
#
|
public
|
prepend(string $path, string $data): int
Prepend to a file.
|
#
|
public
|
append(string $path, string $data): int
Append to a file.
|
#
|
public
|
chmod(string $path, int|null $mode = null): mixed
Get or set UNIX mode of a file or directory.
Get or set UNIX mode of a file or directory.
|
#
|
public
|
delete(string|array $paths): bool
Delete the file at a given path.
Delete the file at a given path.
|
#
|
public
|
move(string $path, string $target): bool
Move a file to a new location.
Move a file to a new location.
|
#
|
public
|
copy(string $path, string $target): bool
Copy a file to a new location.
Copy a file to a new location.
|
#
|
public
|
link(string $target, string $link): void
Create a symlink to the target file or directory. On Windows, a hard link is created if the target is a file.
Create a symlink to the target file or directory. On Windows, a hard link is created if the target is a file.
|
#
|
public
|
relativeLink(string $target, string $link): void
Create a relative symlink to the target file or directory.
Create a relative symlink to the target file or directory.
Throws
|
#
|
public
|
name(string $path): string
Extract the file name from a file path.
Extract the file name from a file path.
|
#
|
public
|
basename(string $path): string
Extract the trailing name component from a file path.
Extract the trailing name component from a file path.
|
#
|
public
|
dirname(string $path): string
Extract the parent directory from a file path.
Extract the parent directory from a file path.
|
#
|
public
|
extension(string $path): string
Extract the file extension from a file path.
Extract the file extension from a file path.
|
#
|
public
|
guessExtension(string $path): string|null
Guess the file extension from the mime-type of a given file.
Guess the file extension from the mime-type of a given file.
Throws
|
#
|
public
|
type(string $path): string
Get the file type of a given file.
Get the file type of a given file.
|
#
|
public
|
mimeType(string $path): string|false
Get the mime-type of a given file.
Get the mime-type of a given file.
|
#
|
public
|
size(string $path): int
Get the file size of a given file.
Get the file size of a given file.
|
#
|
public
|
lastModified(string $path): int
Get the file's last modification time.
Get the file's last modification time.
|
#
|
public
|
isDirectory(string $directory): bool
Determine if the given path is a directory.
Determine if the given path is a directory.
|
#
|
public
|
isReadable(string $path): bool
Determine if the given path is readable.
Determine if the given path is readable.
|
#
|
public
|
isWritable(string $path): bool
Determine if the given path is writable.
Determine if the given path is writable.
|
#
|
public
|
isFile(string $file): bool
Determine if the given path is a file.
Determine if the given path is a file.
|
#
|
public
|
glob(string $pattern, int $flags = 0): array
Find path names matching a given pattern.
Find path names matching a given pattern.
|
#
|
public
|
files(string $directory, bool $hidden = false): SplFileInfo[]
Get an array of all files in a directory.
Get an array of all files in a directory.
|
#
|
public
|
allFiles(string $directory, bool $hidden = false): SplFileInfo[]
Get all of the files from the given directory (recursive).
Get all of the files from the given directory (recursive).
|
#
|
public
|
directories(string $directory): array
Get all of the directories within a given directory.
Get all of the directories within a given directory.
|
#
|
public
|
ensureDirectoryExists(string $path, int $mode = 0755, bool $recursive = true): void
Ensure a directory exists.
Ensure a directory exists.
|
#
|
public
|
makeDirectory(string $path, int $mode = 0755, bool $recursive = false, bool $force = false): bool
Create a directory.
|
#
|
public
|
moveDirectory(string $from, string $to, bool $overwrite = false): bool
Move a directory.
|
#
|
public
|
copyDirectory(string $directory, string $destination, int|null $options = null): bool
Copy a directory from one location to another.
Copy a directory from one location to another.
|
#
|
public
|
deleteDirectory(string $directory, bool $preserve = false): bool
Recursively delete a directory.
Recursively delete a directory.
The directory itself may be optionally preserved.
|
#
|
public
|
deleteDirectories(string $directory): bool
Remove all of the directories within a given directory.
Remove all of the directories within a given directory.
|
#
|
public
|
cleanDirectory(string $directory): bool
Empty the specified directory of all files and folders.
Empty the specified directory of all files and folders.
|
#
|