Methods summary
public static
boolean
|
#
exists( string $path )
Determine if a file exists.
Determine if a file exists.
Parameters
Returns
boolean
|
public static
string
|
#
get( string $path, mixed $default = null )
Get the contents of a file.
Get the contents of a file.
$contents = File::get(path('app').'routes'.EXT);
$contents = File::get(path('app').'routes'.EXT, 'Default Value');
Parameters
- $path
string $path
- $default
mixed $default
Returns
string
|
public static
integer
|
#
put( string $path, string $data )
Write to a file.
Parameters
- $path
string $path
- $data
string $data
Returns
integer
|
public static
integer
|
#
append( string $path, string $data )
Append to a file.
Parameters
- $path
string $path
- $data
string $data
Returns
integer
|
public static
boolean
|
#
delete( string $path )
Delete a file.
Parameters
Returns
boolean
|
public static
|
#
move( string $path, string $target )
Move a file to a new location.
Move a file to a new location.
Parameters
- $path
string $path
- $target
string $target
|
public static
|
#
copy( string $path, string $target )
Copy a file to a new location.
Copy a file to a new location.
Parameters
- $path
string $path
- $target
string $target
|
public static
string
|
#
extension( string $path )
Extract the file extension from a file path.
Extract the file extension from a file path.
Parameters
Returns
string
|
public static
string
|
#
type( string $path )
Get the file type of a given file.
Get the file type of a given file.
Parameters
Returns
string
|
public static
integer
|
#
size( string $path )
Get the file size of a given file.
Get the file size of a given file.
Parameters
Returns
integer
|
public static
integer
|
#
modified( string $path )
Get the file's last modification time.
Get the file's last modification time.
Parameters
Returns
integer
|
public static
string
|
#
mime( string $extension, string $default = 'application/octet-stream' )
Get a file MIME type by extension.
Get a file MIME type by extension.
$mime = File::mime('tar');
$mime = File::mime('ext', 'application/octet-stream');
Parameters
- $extension
string $extension
- $default
string $default
Returns
string
|
public static
boolean
|
#
is( array|string $extensions, string $path )
Determine if a file is of a given type.
Determine if a file is of a given type.
The Fileinfo PHP extension is used to determine the file's MIME type.
$jpg = File::is('jpg', 'path/to/file.jpg');
$image = File::is(array('jpg', 'png', 'gif'), 'path/to/file');
Parameters
- $extensions
array|string $extensions
- $path
string $path
Returns
boolean
|
public static
|
#
mkdir( string $path, integer $chmod = 0777 )
Create a new directory.
Parameters
- $path
string $path
- $chmod
integer $chmod
|
public static
|
#
mvdir( string $source, string $destination, integer $options = Laravel\fIterator::SKIP_DOTS )
Move a directory from one location to another.
Move a directory from one location to another.
Parameters
- $source
string $source
- $destination
string $destination
- $options
integer $options
|
public static
|
#
cpdir( string $source, string $destination, boolean $delete = false, integer $options = Laravel\fIterator::SKIP_DOTS )
Recursively copy directory contents to another directory.
Recursively copy directory contents to another directory.
Parameters
- $source
string $source
- $destination
string $destination
- $delete
boolean $delete
- $options
integer $options
|
public static
|
#
rmdir( string $directory, boolean $preserve = false )
Recursively delete a directory.
Recursively delete a directory.
Parameters
- $directory
string $directory
- $preserve
boolean $preserve
|
public static
|
#
cleandir( string $directory )
Empty the specified directory of all files and folders.
Empty the specified directory of all files and folders.
Parameters
- $directory
string $directory
|
public static
SplFileInfo
|
#
latest( string $directory, integer $options = Laravel\fIterator::SKIP_DOTS )
Get the most recently modified file in a directory.
Get the most recently modified file in a directory.
Parameters
- $directory
string $directory
- $options
integer $options
Returns
|