| Methods |
public
|
copy(string $originFile, string $targetFile, bool $overwriteNewerFiles = false): void
Copies a file.
Copies a file.
If the target file is older than the origin file, it's always overwritten.
If the target file is newer, it is overwritten only when the
$overwriteNewerFiles option is set to true.
Throws
|
#
|
public
|
mkdir(string|iterable $dirs, int $mode = 0777): void
Creates a directory recursively.
Creates a directory recursively.
Throws
|
#
|
public
|
exists(string|iterable $files): bool
Checks the existence of files or directories.
Checks the existence of files or directories.
|
#
|
public
|
touch(string|iterable $files, int|null $time = null, int|null $atime = null): void
Sets access and modification time of file.
Sets access and modification time of file.
Parameters
| $time |
The touch time as a Unix timestamp, if not supplied the current system time is used
|
| $atime |
The access time as a Unix timestamp, if not supplied the current system time is used
|
Throws
|
#
|
public
|
remove(string|iterable $files): void
Removes files or directories.
Removes files or directories.
Throws
|
#
|
private
static
|
doRemove(array $files, bool $isRecursive): void
|
#
|
public
|
chmod(string|iterable $files, int $mode, int $umask = 0000, bool $recursive = false): void
Change mode for an array of files or directories.
Change mode for an array of files or directories.
Parameters
| $mode |
The new mode (octal)
|
| $umask |
The mode mask (octal)
|
| $recursive |
Whether change the mod recursively or not
|
Throws
|
#
|
public
|
chown(string|iterable $files, string|int $user, bool $recursive = false): void
Change the owner of an array of files or directories.
Change the owner of an array of files or directories.
Parameters
| $user |
A user name or number
|
| $recursive |
Whether change the owner recursively or not
|
Throws
|
#
|
public
|
chgrp(string|iterable $files, string|int $group, bool $recursive = false): void
Change the group of an array of files or directories.
Change the group of an array of files or directories.
Parameters
| $group |
A group name or number
|
| $recursive |
Whether change the group recursively or not
|
Throws
|
#
|
public
|
rename(string $origin, string $target, bool $overwrite = false): void
Renames a file or a directory.
Renames a file or a directory.
Throws
|
#
|
private
|
isReadable(string $filename): bool
Tells whether a file exists and is readable.
Tells whether a file exists and is readable.
Throws
|
#
|
public
|
symlink(string $originDir, string $targetDir, bool $copyOnWindows = false): void
Creates a symbolic link or copy a directory.
Creates a symbolic link or copy a directory.
Throws
|
#
|
public
|
hardlink(string $originFile, string|string[] $targetFiles): void
Creates a hard link, or several hard links to a file.
Creates a hard link, or several hard links to a file.
Parameters
| $targetFiles |
The target file(s)
|
Throws
|
#
|
private
|
linkException(string $origin, string $target, string $linkType): never
Parameters
| $linkType |
Name of the link type, typically 'symbolic' or 'hard'
|
|
#
|
public
|
readlink(string $path, bool $canonicalize = false): ?string
Resolves links in paths.
Resolves links in paths.
With $canonicalize = false (default)
- if $path does not exist or is not a link, returns null
- if $path is a link, returns the next direct target of the link without considering the existence of the target
With $canonicalize = true
- if $path does not exist, returns null
- if $path exists, returns its absolute fully resolved final version
|
#
|
public
|
makePathRelative(string $endPath, string $startPath): string
Given an existing path, convert it to a path relative to a given starting path.
Given an existing path, convert it to a path relative to a given starting path.
|
#
|
public
|
mirror(string $originDir, string $targetDir, Traversable|null $iterator = null, array $options = []): void
Mirrors a directory to another.
Mirrors a directory to another.
Copies files and directories from the origin directory into the target directory. By default:
- existing files in the target directory will be overwritten, except if they are newer (see the
override option)
- files in the target directory that do not exist in the source directory will not be deleted (see the
delete option)
Parameters
| $iterator |
Iterator that filters which files and directories to copy, if null a recursive iterator is created
|
| $options |
An array of boolean options
Valid options are:
- $options['override'] If true, target files newer than origin files are overwritten (see copy(), defaults to false)
- $options['copy_on_windows'] Whether to copy files instead of links on Windows (see symlink(), defaults to false)
- $options['delete'] Whether to delete files that are not in the source directory (defaults to false)
|
Throws
|
#
|
public
|
isAbsolutePath(string $file): bool
Returns whether the file path is an absolute path.
Returns whether the file path is an absolute path.
|
#
|
public
|
tempnam(string $dir, string $prefix, string $suffix = ''): string
Creates a temporary file with support for custom stream wrappers.
Creates a temporary file with support for custom stream wrappers.
Parameters
| $prefix |
The prefix of the generated temporary filename
Note: Windows uses only the first three characters of prefix
|
| $suffix |
The suffix of the generated temporary filename
|
Returns
The new temporary filename (with path), or throw an exception on failure
|
#
|
public
|
dumpFile(string $filename, string|resource $content): void
Atomically dumps content into a file.
Atomically dumps content into a file.
Parameters
| $content |
The data to write into the file
|
Throws
|
#
|
public
|
appendToFile(string $filename, string|resource $content): void
Appends content to an existing file.
Appends content to an existing file.
Parameters
| $content |
The content to append
|
Throws
|
#
|
private
|
toIterable(string|iterable $files): iterable
|
#
|
private
|
getSchemeAndHierarchy(string $filename): array
Gets a 2-tuple of scheme (may be null) and hierarchical part of a filename (e.g. file:///tmp -> [file, tmp]).
Gets a 2-tuple of scheme (may be null) and hierarchical part of a filename (e.g. file:///tmp -> [file, tmp]).
|
#
|
private
static
|
assertFunctionExists(string $func): void
|
#
|
private
static
|
box(string $func, mixed ...$args): mixed
|
#
|