Leaf PHP

Storage
in package

Table of Contents

Properties

$errorsArray  : mixed

Methods

basename()  : string
Return the last part of the path
chmod()  : mixed
Get or set UNIX mode of a file or directory.
copy()  : bool
Copy a file or directory
createFile()  : bool
Create a new file
createFolder()  : bool
Create a new directory
delete()  : bool
Delete a file or directory
dirname()  : string
Return the parent directory of the path
errors()  : array<string|int, mixed>
Return all errors that occurred
exists()  : bool
Check if a file/directory exists
extension()  : string
Return the extension of the file
info()  : array<string|int, mixed>|bool
Get a summary of the file/directory information
isDir()  : bool
Check if a path is a directory
isEmpty()  : bool
Check if a file or directory is empty
isFile()  : bool
Check if a path is a file
lastModified()  : string
Get the last modified date of a file
link()  : string|bool
Create a symlink to the target file or directory. On Windows, a hard link is created if the target is a file.
list()  : mixed
move()  : bool
Move a file or directory
read()  : mixed
Read the content of a file
rename()  : bool
Rename a file or directory
size()  : number
Get the size of a file/folder
type()  : string
Get the human readable file type of a file
upload()  : bool
Upload a file
writeFile()  : bool
Write content to a file

Properties

$errorsArray

protected static mixed $errorsArray = []

Methods

basename()

Return the last part of the path

public static basename(string $filePath) : string
Parameters
$filePath : string

The path of the file to get the basename of

Return values
string

chmod()

Get or set UNIX mode of a file or directory.

public static chmod(string $path[, int|null $mode = null ]) : mixed
Parameters
$path : string
$mode : int|null = null

copy()

Copy a file or directory

public static copy(string $source, string $destination[, array<string|int, mixed> $options = [] ]) : bool
Parameters
$source : string

The path of the file or directory to copy

$destination : string

The path to copy the file or directory to

$options : array<string|int, mixed> = []

Options for copying the file or directory

Return values
bool

createFile()

Create a new file

public static createFile(string $filePath[, mixed $content = null ][, array<string|int, mixed> $options = [] ]) : bool
Parameters
$filePath : string

The path of the new file

$content : mixed = null

The content of the new file

$options : array<string|int, mixed> = []

Options for creating the file

Return values
bool

createFolder()

Create a new directory

public static createFolder(string $dirPath[, array<string|int, mixed> $options = [] ]) : bool
Parameters
$dirPath : string

The path of the new directory

$options : array<string|int, mixed> = []

Options for creating the directory

Return values
bool

delete()

Delete a file or directory

public static delete(string $source) : bool
Parameters
$source : string
Return values
bool

dirname()

Return the parent directory of the path

public static dirname(string $filePath) : string
Parameters
$filePath : string

The path of the file to get the dirname of

Return values
string

errors()

Return all errors that occurred

public static errors() : array<string|int, mixed>
Return values
array<string|int, mixed>

exists()

Check if a file/directory exists

public static exists(string $filePath) : bool
Parameters
$filePath : string

The path of the file/directory to check

Return values
bool

extension()

Return the extension of the file

public static extension(string $filePath) : string
Parameters
$filePath : string

The path of the file to get the extension of

Return values
string

info()

Get a summary of the file/directory information

public static info(string $filePath) : array<string|int, mixed>|bool
Parameters
$filePath : string

The path of the file/directory to get the summary of

Return values
array<string|int, mixed>|bool

isDir()

Check if a path is a directory

public static isDir(string $dirPath) : bool
Parameters
$dirPath : string

The path of the file to check

Return values
bool

isEmpty()

Check if a file or directory is empty

public static isEmpty(string $path) : bool
Parameters
$path : string
Return values
bool

isFile()

Check if a path is a file

public static isFile(string $filePath) : bool
Parameters
$filePath : string

The path of the file to check

Return values
bool

lastModified()

Get the last modified date of a file

public static lastModified(string $filePath) : string
Parameters
$filePath : string

The path of the file to get the last modified date of

Return values
string

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

public static link(string $target, string $link) : string|bool
Parameters
$target : string
$link : string
Return values
string|bool

list()

public static list(string $dirPath[, mixed $filter = null ]) : mixed
Parameters
$dirPath : string
$filter : mixed = null

move()

Move a file or directory

public static move(string $source, string $destination[, array<string|int, mixed> $options = [] ]) : bool
Parameters
$source : string

The path of the file or directory to move

$destination : string

The path to move the file or directory to

$options : array<string|int, mixed> = []

Options for moving the file or directory

Return values
bool

read()

Read the content of a file

public static read(string $filePath) : mixed
Parameters
$filePath : string

The path of the file to read

rename()

Rename a file or directory

public static rename(string $name, string $newName) : bool
Parameters
$name : string

The path of the file/directory to rename

$newName : string

The path to rename the file/directory to

Return values
bool

size()

Get the size of a file/folder

public static size(string $filePath[, string $unit = 'byte' ]) : number
Parameters
$filePath : string

The path of the file/folder to get the size of

$unit : string = 'byte'

The unit to return the size in

Return values
number

type()

Get the human readable file type of a file

public static type(string $filePath) : string
Parameters
$filePath : string

The path of the file to get the type of

Return values
string

upload()

Upload a file

public static upload(mixed $filePath, string $destination[, array<string|int, mixed> $options = [] ]) : bool
Parameters
$filePath : mixed

The path of the file to upload

$destination : string

The path to upload the file to

$options : array<string|int, mixed> = []

Options for uploading the file

Return values
bool

writeFile()

Write content to a file

public static writeFile(string $filePath, mixed $content[, int $mode = 0 ]) : bool
Parameters
$filePath : string

The path of the file to write to

$content : mixed

The content to write to the file

$mode : int = 0

The mode to write the file in

Return values
bool

        
On this page

Search results