October\Rain\Filesystem\Filesystem

Source: ~/vendor/october/rain/src/Filesystem/Filesystem.php

Extends:

  • Illuminate\Filesystem\Filesystem

File helper

Public properties

public string $filePermissions

Default file permission mask as a string ("777").

public string $folderPermissions

Default folder permission mask as a string ("777").

public array $pathSymbols

Known path symbols and their prefixes.

Protected properties

There are no protected properties in the class.

Show inherited protected properties

Inherited protected properties

  • protected static array $macros - defined in Illuminate\Filesystem\Filesystem. The registered string macros.

Public methods

public void chmod(string $path, octal $mask=NULL)

Modify file/folder permissions

Parameters
  • string $path
  • octal $mask

public void chmodRecursive(string $path, octal $fileMask=NULL, octal $directoryMask=NULL)

Modify file/folder permissions recursively

Parameters
  • string $path
  • octal $fileMask
  • octal $directoryMask

public bool copy(string $path, string $target)

Copy a file to a new location.

Parameters
  • string $path
  • string $target

public mixed existsInsensitive(string $path)

Determine if a file exists with case insensitivity supported for the file only.

Parameters
  • string $path

public bool fileNameMatch(string|array $fileName, string $pattern)

Match filename against a pattern.

Parameters
  • string|array $fileName
  • string $pattern

public string fromClass(mixed $className)

Finds the path to a class

Parameters
  • mixed $className - Class name or object

public string getFilePermissions()

Returns the default file permission mask to use.

public string getFolderPermissions()

Returns the default folder permission mask to use.

public bool isDirectoryEmpty(string $directory)

Determine if the given path contains no files.

Parameters
  • string $directory

public boolean isLocalPath(string $path, boolean $realpath=true)

Returns true if the specified path is within the path of the application

Parameters
  • string $path - The path to
  • boolean $realpath - Default true, uses realpath() to resolve the provided path before checking location. Set to false if you need to check if a potentially non-existent path would be within the application path

public boolean isPathSymbol(string $path)

Returns true if the path uses a symbol.

Parameters
  • string $path

public string localToPublic(string $path)

Returns a public file path from an absolute one eg: /home/mysite/public_html/welcome -> /welcome

Parameters
  • string $path - Absolute path

public bool makeDirectory(string $path, int $mode=511, bool $recursive=false, bool $force=false)

Create a directory.

Parameters
  • string $path
  • int $mode
  • bool $recursive
  • bool $force

public string normalizePath(string $path)

Normalizes the directory separator, often used by Win systems.

Parameters
  • string $path - Path name

public int put(string $path, string $contents, $lock=false)

Write the contents of a file.

Parameters
  • string $path
  • string $contents
  • $lock

public string sizeToString(int $bytes)

Converts a file size in bytes to human readable format.

Parameters
  • int $bytes

public 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.

Parameters
  • string $path
  • mixed $default

Show inherited public methods

Inherited public methods

  • public mixed __call(string $method, array $parameters) - defined in Illuminate\Filesystem\Filesystem. Dynamically handle calls to the class.
  • public static mixed __callStatic(string $method, array $parameters) - defined in Illuminate\Filesystem\Filesystem. Dynamically handle calls to the class.
  • public Symfony\Component\Finder\SplFileInfo[] allFiles(string $directory, bool $hidden=false) - defined in Illuminate\Filesystem\Filesystem. Get all of the files from the given directory (recursive).
  • public int append(string $path, string $data) - defined in Illuminate\Filesystem\Filesystem. Append to a file.
  • public string basename(string $path) - defined in Illuminate\Filesystem\Filesystem. Extract the trailing name component from a file path.
  • public bool cleanDirectory(string $directory) - defined in Illuminate\Filesystem\Filesystem. Empty the specified directory of all files and folders.
  • public bool copyDirectory(string $directory, string $destination, int $options=NULL) - defined in Illuminate\Filesystem\Filesystem. Copy a directory from one location to another.
  • public bool delete(string|array $paths) - defined in Illuminate\Filesystem\Filesystem. Delete the file at a given path.
  • public bool deleteDirectory(string $directory, bool $preserve=false) - defined in Illuminate\Filesystem\Filesystem. Recursively delete a directory.
  • public array directories(string $directory) - defined in Illuminate\Filesystem\Filesystem. Get all of the directories within a given directory.
  • public string dirname(string $path) - defined in Illuminate\Filesystem\Filesystem. Extract the parent directory from a file path.
  • public bool exists(string $path) - defined in Illuminate\Filesystem\Filesystem. Determine if a file or directory exists.
  • public string extension(string $path) - defined in Illuminate\Filesystem\Filesystem. Extract the file extension from a file path.
  • public Symfony\Component\Finder\SplFileInfo[] files(string $directory, bool $hidden=false) - defined in Illuminate\Filesystem\Filesystem. Get an array of all files in a directory.
  • public string get(string $path, bool $lock=false) - defined in Illuminate\Filesystem\Filesystem. Get the contents of a file.
  • public mixed getRequire(string $path) - defined in Illuminate\Filesystem\Filesystem. Get the returned value of a file.
  • public array glob(string $pattern, int $flags=0) - defined in Illuminate\Filesystem\Filesystem. Find path names matching a given pattern.
  • public static bool hasMacro(string $name) - defined in Illuminate\Filesystem\Filesystem. Checks if macro is registered.
  • public string hash(string $path) - defined in Illuminate\Filesystem\Filesystem. Get the MD5 hash of the file at the given path.
  • public bool isDirectory(string $directory) - defined in Illuminate\Filesystem\Filesystem. Determine if the given path is a directory.
  • public bool isFile(string $file) - defined in Illuminate\Filesystem\Filesystem. Determine if the given path is a file.
  • public bool isReadable(string $path) - defined in Illuminate\Filesystem\Filesystem. Determine if the given path is readable.
  • public bool isWritable(string $path) - defined in Illuminate\Filesystem\Filesystem. Determine if the given path is writable.
  • public int lastModified(string $path) - defined in Illuminate\Filesystem\Filesystem. Get the file's last modification time.
  • public void link(string $target, string $link) - defined in Illuminate\Filesystem\Filesystem. Create a hard link to the target file or directory.
  • public static void macro(string $name, object|callable $macro) - defined in Illuminate\Filesystem\Filesystem. Register a custom macro.
  • public string|false mimeType(string $path) - defined in Illuminate\Filesystem\Filesystem. Get the mime-type of a given file.
  • public static void mixin(object $mixin) - defined in Illuminate\Filesystem\Filesystem. Mix another object into the class.
  • public bool move(string $path, string $target) - defined in Illuminate\Filesystem\Filesystem. Move a file to a new location.
  • public bool moveDirectory(string $from, string $to, bool $overwrite=false) - defined in Illuminate\Filesystem\Filesystem. Move a directory.
  • public string name(string $path) - defined in Illuminate\Filesystem\Filesystem. Extract the file name from a file path.
  • public int prepend(string $path, string $data) - defined in Illuminate\Filesystem\Filesystem. Prepend to a file.
  • public mixed requireOnce(string $file) - defined in Illuminate\Filesystem\Filesystem. Require the given file once.
  • public string sharedGet(string $path) - defined in Illuminate\Filesystem\Filesystem. Get contents of a file with shared access.
  • public int size(string $path) - defined in Illuminate\Filesystem\Filesystem. Get the file size of a given file.
  • public string type(string $path) - defined in Illuminate\Filesystem\Filesystem. Get the file type of a given file.