class Illuminate / Filesystem / Filesystem
You're browsing the documentation for an upcoming version of Laravel. The documentation and features of this release are subject to change.

Filesystem

Uses

Methods

public

exists ( $path ) : bool

Determine if a file or directory exists.

Parameters

  • $path string
public

missing ( $path ) : bool

Determine if a file or directory is missing.

Parameters

  • $path string
public

get ( $path , $lock ) : string

Get the contents of a file.

Parameters

  • $path string
  • $lock bool
public

json ( $path , $flags , $lock ) : array

Get the contents of a file as decoded JSON.

Parameters

  • $path string
  • $flags int
  • $lock bool
public

sharedGet ( $path ) : string

Get contents of a file with shared access.

Parameters

  • $path string
public

getRequire ( $path , array $data ) : mixed

Get the returned value of a file.

Parameters

  • $path string
  • $data array
public

requireOnce ( $path , array $data ) : mixed

Require the given file once.

Parameters

  • $path string
  • $data array
public

lines ( $path ) : Illuminate\...\LazyCollection

Get the contents of a file one line at a time.

Parameters

  • $path string
public

hash ( $path , $algorithm ) : string

Get the hash of the file at the given path.

Parameters

  • $path string
  • $algorithm string
public

put ( $path , $contents , $lock ) : int|bool

Write the contents of a file.

Parameters

  • $path string
  • $contents string
  • $lock bool
public

replace ( $path , $content , $mode ) : void

Write the contents of a file, replacing it atomically if it already exists.

Parameters

  • $path string
  • $content string
  • $mode int|null
public

replaceInFile ( $search , $replace , $path ) : void

Replace a given string within a given file.

Parameters

  • $search array|string
  • $replace array|string
  • $path string
public

prepend ( $path , $data ) : int

Prepend to a file.

Parameters

  • $path string
  • $data string
public

append ( $path , $data ) : int

Append to a file.

Parameters

  • $path string
  • $data string
public

chmod ( $path , $mode ) : mixed

Get or set UNIX mode of a file or directory.

Parameters

  • $path string
  • $mode int|null
public

delete ( $paths ) : bool

Delete the file at a given path.

Parameters

  • $paths string|array
public

move ( $path , $target ) : bool

Move a file to a new location.

Parameters

  • $path string
  • $target string
public

copy ( $path , $target ) : bool

Copy a file to a new location.

Parameters

  • $path string
  • $target string
public

Create a symlink to the target file or directory. On Windows, a hard link is created if the target is a file.

Parameters

  • $target string
  • $link string
public

Create a relative symlink to the target file or directory.

Parameters

  • $target string
  • $link string
public

name ( $path ) : string

Extract the file name from a file path.

Parameters

  • $path string
public

basename ( $path ) : string

Extract the trailing name component from a file path.

Parameters

  • $path string
public

dirname ( $path ) : string

Extract the parent directory from a file path.

Parameters

  • $path string
public

extension ( $path ) : string

Extract the file extension from a file path.

Parameters

  • $path string
public

guessExtension ( $path ) : string|null

Guess the file extension from the mime-type of a given file.

Parameters

  • $path string
public

type ( $path ) : string

Get the file type of a given file.

Parameters

  • $path string
public

mimeType ( $path ) : string|false

Get the mime-type of a given file.

Parameters

  • $path string
public

size ( $path ) : int

Get the file size of a given file.

Parameters

  • $path string
public

lastModified ( $path ) : int

Get the file's last modification time.

Parameters

  • $path string
public

isDirectory ( $directory ) : bool

Determine if the given path is a directory.

Parameters

  • $directory string
public

isEmptyDirectory ( $directory , $ignoreDotFiles ) : bool

Determine if the given path is a directory that does not contain any other files or directories.

Parameters

  • $directory string
  • $ignoreDotFiles bool
public

isReadable ( $path ) : bool

Determine if the given path is readable.

Parameters

  • $path string
public

isWritable ( $path ) : bool

Determine if the given path is writable.

Parameters

  • $path string
public

hasSameHash ( $firstFile , $secondFile ) : bool

Determine if two files are the same by comparing their hashes.

Parameters

  • $firstFile string
  • $secondFile string
public

isFile ( $file ) : bool

Determine if the given path is a file.

Parameters

  • $file string
public

glob ( $pattern , $flags ) : array

Find path names matching a given pattern.

Parameters

  • $pattern string
  • $flags int
public

files ( $directory , $hidden ) : Symfony\...\SplFileInfo[]

Get an array of all files in a directory.

Parameters

  • $directory string
  • $hidden bool
public

allFiles ( $directory , $hidden ) : Symfony\...\SplFileInfo[]

Get all of the files from the given directory (recursive).

Parameters

  • $directory string
  • $hidden bool
public

directories ( $directory ) : array

Get all of the directories within a given directory.

Parameters

  • $directory string
public

ensureDirectoryExists ( $path , $mode , $recursive ) : void

Ensure a directory exists.

Parameters

  • $path string
  • $mode int
  • $recursive bool
public

makeDirectory ( $path , $mode , $recursive , $force ) : bool

Create a directory.

Parameters

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

moveDirectory ( $from , $to , $overwrite ) : bool

Move a directory.

Parameters

  • $from string
  • $to string
  • $overwrite bool
public

copyDirectory ( $directory , $destination , $options ) : bool

Copy a directory from one location to another.

Parameters

  • $directory string
  • $destination string
  • $options int|null
public

deleteDirectory ( $directory , $preserve ) : bool

Recursively delete a directory.

Parameters

  • $directory string
  • $preserve bool
public

deleteDirectories ( $directory ) : bool

Remove all of the directories within a given directory.

Parameters

  • $directory string
public

cleanDirectory ( $directory ) : bool

Empty the specified directory of all files and folders.

Parameters

  • $directory string