fs

php\lib\fs

File System class.

Class fs

Methods


static separator

Return the local filesystem’s name-separator character.

Результат:string
static pathSeparator

Return the local filesystem’s path-separator character.

Результат:string
static valid($name)

Validate file name.

Параметры:
  • $name
Результат:

bool

static abs($path)

Returns absolute real path.

Параметры:
  • $path
Результат:

string

static name($path)
Параметры:
  • $path
Результат:

string

static nameNoExt($path)
Параметры:
  • $path
Результат:

string

static pathNoExt($path)

Returns path without extension.

Параметры:
  • $pathstring
Результат:

string

static ext($path)

Returns extension of path.

Параметры:
  • $path
Результат:

string

static hasExt($path, $extensions = null, $ignoreCase = true)

Check that $path has an extension from the extension set.

Параметры:
  • $pathstring
  • $extensionsstring, array
  • $ignoreCasebool
Результат:

bool

static parent($path)

Returns parent directory.

Параметры:
  • $path
Результат:

string

static ensureParent($path)

Checks parent of path and if it is not exists, tries to create parent directory. See makeDir().

Параметры:
  • $pathstring
Результат:

bool

static normalize($path)

Normalizes file path for current OS.

Параметры:
  • $path
Результат:

string

static exists($path)
Параметры:
  • $path
Результат:

string

static size($path)

Returns size of file in bytes.

Параметры:
  • $path
Результат:

int

static isFile($path)
Параметры:
  • $path
Результат:

bool

static isDir($path)
Параметры:
  • $path
Результат:

bool

static isHidden($path)
Параметры:
  • $path
Результат:

bool

static time($path)

Returns last modification time of file or directory.

Параметры:
  • $path
Результат:

int

static makeDir($path)

Creates empty directory (mkdirs) if not exists.

Параметры:
  • $path
Результат:

bool

static makeFile($path)

Creates empty file, if file already exists then rewrite it.

Параметры:
  • $path
Результат:

bool

static delete($path)

Deletes file or empty directory.

Параметры:
  • $path
Результат:

bool

static clean($path, $checker = null)

Deletes all files in path. This method does not delete the $path directory. Returns array with error, success and skip file list.

Параметры:
  • $pathstring
  • $checkercallable - (File $file, $depth) optional, must return true to delete the file.
Результат:

array [success => [], error => [], skip = []]

static scan($path, $onProgress, $maxDepth = 0, $subIsFirst = false)
Параметры:
  • $pathstring
  • $onProgresscallable - (File $file, $depth)
  • $maxDepthint - if 0 then unlimited.
  • $subIsFirstbool
static hash($source, $algo = 'MD5')

Calculates hash of file or stream.

Параметры:
  • $sourcestring, php\io\Stream
  • $algostring - MD5, MD2, SHA-1, SHA-256, SHA-512
Результат:

string

static copy($source, $dest, $onProgress = null)

Copies $source stream to $dest stream.

Параметры:
Результат:

int copied bytes.

static get($source, $charset = null, $mode = 'r')

Reads fully data from source and returns it as binary string.

Параметры:
  • $sourcestring
  • $charsetnull, string - UTF-8, windows-1251, etc.
  • $modestring
Результат:

string