PHP Class Valet\Filesystem

显示文件 Open project: laravel/valet Class Usage Examples

Public Methods

Method Description
append ( string $path, string $contents, string | null $owner = null ) : void Append the contents to the given file.
appendAsUser ( string $path, string $contents ) : void Append the contents to the given file as the non-root user.
chgrp ( string $path, string $group ) Change the group of the given path.
chown ( string $path, string $user ) Change the owner of the given path.
copy ( string $from, string $to ) : void Copy the given file to a new location.
copyAsUser ( string $from, string $to ) : void Copy the given file to a new location for the non-root user.
ensureDirExists ( string $path, string | null $owner = null, integer $mode = 493 ) : void Ensure that the given directory exists.
exists ( string $path ) : boolean Determine if the given file exists.
get ( string $path ) : string Read the contents of the given file.
isBrokenLink ( string $path ) : boolean Determine if the given path is a broken symbolic link.
isDir ( string $path ) : boolean Determine if the given path is a directory.
isLink ( string $path ) : boolean Determine if the given path is a symbolic link.
mkdir ( string $path, string | null $owner = null, integer $mode = 493 ) : void Create a directory.
mkdirAsUser ( string $path, integer $mode = 493 ) : void Create a directory as the non-root user.
put ( string $path, string $contents, string | null $owner = null ) : string Write to the given file.
putAsUser ( string $path, string $contents ) : string Write to the given file as the non-root user.
readLink ( string $path ) : string Resolve the given symbolic link.
realpath ( string $path ) : string Resolve the given path.
removeBrokenLinksAt ( string $path ) : void Remove all of the broken symbolic links at the given path.
scandir ( string $path ) : array Scan the given directory path.
symlink ( string $target, string $link ) : void Create a symlink to the given target.
symlinkAsUser ( string $target, string $link ) : void Create a symlink to the given target for the non-root user.
touch ( string $path, string | null $owner = null ) : string Touch the given path.
touchAsUser ( string $path ) : void Touch the given path as the non-root user.
unlink ( string $path ) : void Delete the file at the given path.

Method Details

append() public method

Append the contents to the given file.
public append ( string $path, string $contents, string | null $owner = null ) : void
$path string
$contents string
$owner string | null
return void

appendAsUser() public method

Append the contents to the given file as the non-root user.
public appendAsUser ( string $path, string $contents ) : void
$path string
$contents string
return void

chgrp() public method

Change the group of the given path.
public chgrp ( string $path, string $group )
$path string
$group string

chown() public method

Change the owner of the given path.
public chown ( string $path, string $user )
$path string
$user string

copy() public method

Copy the given file to a new location.
public copy ( string $from, string $to ) : void
$from string
$to string
return void

copyAsUser() public method

Copy the given file to a new location for the non-root user.
public copyAsUser ( string $from, string $to ) : void
$from string
$to string
return void

ensureDirExists() public method

Ensure that the given directory exists.
public ensureDirExists ( string $path, string | null $owner = null, integer $mode = 493 ) : void
$path string
$owner string | null
$mode integer
return void

exists() public method

Determine if the given file exists.
public exists ( string $path ) : boolean
$path string
return boolean

get() public method

Read the contents of the given file.
public get ( string $path ) : string
$path string
return string

isDir() public method

Determine if the given path is a directory.
public isDir ( string $path ) : boolean
$path string
return boolean

mkdir() public method

Create a directory.
public mkdir ( string $path, string | null $owner = null, integer $mode = 493 ) : void
$path string
$owner string | null
$mode integer
return void

mkdirAsUser() public method

Create a directory as the non-root user.
public mkdirAsUser ( string $path, integer $mode = 493 ) : void
$path string
$mode integer
return void

put() public method

Write to the given file.
public put ( string $path, string $contents, string | null $owner = null ) : string
$path string
$contents string
$owner string | null
return string

putAsUser() public method

Write to the given file as the non-root user.
public putAsUser ( string $path, string $contents ) : string
$path string
$contents string
return string

realpath() public method

Resolve the given path.
public realpath ( string $path ) : string
$path string
return string

removeBrokenLinksAt() public method

Remove all of the broken symbolic links at the given path.
public removeBrokenLinksAt ( string $path ) : void
$path string
return void

scandir() public method

Scan the given directory path.
public scandir ( string $path ) : array
$path string
return array

symlinkAsUser() public method

This uses the command line as PHP can't change symlink permissions.
public symlinkAsUser ( string $target, string $link ) : void
$target string
$link string
return void

touch() public method

Touch the given path.
public touch ( string $path, string | null $owner = null ) : string
$path string
$owner string | null
return string

touchAsUser() public method

Touch the given path as the non-root user.
public touchAsUser ( string $path ) : void
$path string
return void