: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
* Reads entire file into an array.
* @param string $file Path to the file.
* @return array|false File contents in an array on success, false on failure.
public function get_contents_array( $file ) {
* Writes a string to a file.
* @param string $file Remote path to the file where to write the data.
* @param string $contents The data to write.
* @param int|false $mode Optional. The file permissions as octal number, usually 0644.
* @return bool True on success, false on failure.
public function put_contents( $file, $contents, $mode = false ) {
* Gets the current working directory.
* @return string|false The current working directory on success, false on failure.
* Changes current directory.
* @param string $dir The new current directory.
* @return bool True on success, false on failure.
public function chdir( $dir ) {
* Changes the file group.
* @param string $file Path to the file.
* @param string|int $group A group name or number.
* @param bool $recursive Optional. If set to true, changes file group recursively.
* @return bool True on success, false on failure.
public function chgrp( $file, $group, $recursive = false ) {
* Changes filesystem permissions.
* @param string $file Path to the file.
* @param int|false $mode Optional. The permissions as octal number, usually 0644 for files,
* 0755 for directories. Default false.
* @param bool $recursive Optional. If set to true, changes file permissions recursively.
* @return bool True on success, false on failure.
public function chmod( $file, $mode = false, $recursive = false ) {
* @param string $file Path to the file.
* @return string|false Username of the owner on success, false on failure.
public function owner( $file ) {
* @param string $file Path to the file.
* @return string|false The group on success, false on failure.
public function group( $file ) {
* @param string $source Path to the source file.
* @param string $destination Path to the destination file.
* @param bool $overwrite Optional. Whether to overwrite the destination file if it exists.
* @param int|false $mode Optional. The permissions as octal number, usually 0644 for files,
* 0755 for dirs. Default false.
* @return bool True on success, false on failure.
public function copy( $source, $destination, $overwrite = false, $mode = false ) {
* @param string $source Path to the source file.
* @param string $destination Path to the destination file.
* @param bool $overwrite Optional. Whether to overwrite the destination file if it exists.
* @return bool True on success, false on failure.
public function move( $source, $destination, $overwrite = false ) {
* Deletes a file or directory.
* @param string $file Path to the file or directory.
* @param bool $recursive Optional. If set to true, deletes files and folders recursively.
* @param string|false $type Type of resource. 'f' for file, 'd' for directory.
* @return bool True on success, false on failure.
public function delete( $file, $recursive = false, $type = false ) {
* Checks if a file or directory exists.
* @param string $path Path to file or directory.
* @return bool Whether $path exists or not.
public function exists( $path ) {
* Checks if resource is a file.
* @param string $file File path.
* @return bool Whether $file is a file.
public function is_file( $file ) {
* Checks if resource is a directory.
* @param string $path Directory path.
* @return bool Whether $path is a directory.
public function is_dir( $path ) {
* Checks if a file is readable.
* @param string $file Path to file.
* @return bool Whether $file is readable.
public function is_readable( $file ) {
* Checks if a file or directory is writable.
* @param string $path Path to file or directory.
* @return bool Whether $path is writable.
public function is_writable( $path ) {
* Gets the file's last access time.
* @param string $file Path to file.
* @return int|false Unix timestamp representing last access time, false on failure.
public function atime( $file ) {
* Gets the file modification time.
* @param string $file Path to file.
* @return int|false Unix timestamp representing modification time, false on failure.
public function mtime( $file ) {
* Gets the file size (in bytes).
* @param string $file Path to file.
* @return int|false Size of the file in bytes on success, false on failure.
public function size( $file ) {
* Sets the access and modification times of a file.
* Note: If $file doesn't exist, it will be created.
* @param string $file Path to file.
* @param int $time Optional. Modified time to set for file.
* @param int $atime Optional. Access time to set for file.
* @return bool True on success, false on failure.
public function touch( $file, $time = 0, $atime = 0 ) {
* @param string $path Path for new directory.
* @param int|false $chmod Optional. The permissions as octal number (or false to skip chmod).
* @param string|int|false $chown Optional. A user name or number (or false to skip chown).
* @param string|int|false $chgrp Optional. A group name or number (or false to skip chgrp).
* @return bool True on success, false on failure.
public function mkdir( $path, $chmod = false, $chown = false, $chgrp = false ) {
* @param string $path Path to directory.
* @param bool $recursive Optional. Whether to recursively remove files/directories.
* @return bool True on success, false on failure.
public function rmdir( $path, $recursive = false ) {
* Gets details for files in a directory or a specific file.
* @param string $path Path to directory or file.
* @param bool $include_hidden Optional. Whether to include details of hidden ("." prefixed) files.
* @param bool $recursive Optional. Whether to recursively include file details in nested directories.
* Array of arrays containing file information. False if unable to list directory contents.
* Array of file information. Note that some elements may not be available on all filesystems.
* @type string $name Name of the file or directory.
* @type string $perms *nix representation of permissions.
* @type string $permsn Octal representation of permissions.
* @type int|string|false $number File number. May be a numeric string. False if not available.
* @type string|false $owner Owner name or ID, or false if not available.
* @type string|false $group File permissions group, or false if not available.
* @type int|string|false $size Size of file in bytes. May be a numeric string.
* False if not available.
* @type int|string|false $lastmodunix Last modified unix timestamp. May be a numeric string.
* False if not available.
* @type string|false $lastmod Last modified month (3 letters) and day (without leading 0), or
* false if not available.
* @type string|false $time Last modified time, or false if not available.
* @type string $type Type of resource. 'f' for file, 'd' for directory, 'l' for link.
* @type array|false $files If a directory and `$recursive` is true, contains another array of
* files. False if unable to list directory contents.
public function dirlist( $path, $include_hidden = true, $recursive = false ) {