protected Backend $backend
protected Manager $manager
protected bool $allowHidden
public string $relativePath
public __construct(string $path, ?Manager $manager, ?string $relativePath): void
| Parameter | Type | Description |
|---|
$path | string | |
$manager | Manager | |
$relativePath | string | |
public __toString(): string
public getManager(): Manager
public setMeta(array $values): bool
| Parameter | Type | Description |
|---|
$values | array | |
public getMeta(?string $key): mixed
| Parameter | Type | Description |
|---|
$key | string | |
public toString(): string
public path(?string $suffix): string
| Parameter | Type | Description |
|---|
$suffix | string | |
public fullpath(?string $suffix): string
| Parameter | Type | Description |
|---|
$suffix | string | |
Get the relative path of the directory.
public relativepath(string $path): string
If the file was returned from a Hazaar\File\Dir object, then it will have a stored relative path. Otherwise any file/path can be provided in the form of another [[Hazaar\File\ object, Hazaar\File\Dir object, or string path, and the relative path to the file will be returned.
| Parameter | Type | Description |
|---|
$path | string | |
public setRelativePath(string $path): void
| Parameter | Type | Description |
|---|
$path | string | |
public realpath(): string
public extension(): string
public basename(): string
public exists(?string $filename): bool
| Parameter | Type | Description |
|---|
$filename | string | |
public isReadable(): bool
public isWritable(): bool
public allowHidden(bool $toggle = true): void
| Parameter | Type | Description |
|---|
$toggle | bool | |
public create(bool $recursive): bool
| Parameter | Type | Description |
|---|
$recursive | bool | |
public rename(string $newname): bool
| Parameter | Type | Description |
|---|
$newname | string | |
Delete the directory, optionally removing all it's contents.
public delete(bool $recursive): bool
Executing this method will simply delete or "unlink" the directory. Normally it must be empty to succeed. However specifying the $recursive parameter as TRUE will delete everything inside the directory, recursively (obviously).
| Parameter | Type | Description |
|---|
$recursive | bool | |
File::unlink() compatible delete that removes dir and all contents (ie: recursive).
Empty a directory of all it's contents.
public (boolean $includeHidden): void
This is the same as calling delete(true) except that the directory itself is not deleted.
By default hidden files are not deleted. This is for protection. You can choose to delete them as well by setting $includeHidden to true.
| Parameter | Type | Description |
|---|
$includeHidden | boolean | also delete hidden files |
public read(?string $regexFilter): File
| Parameter | Type | Description |
|---|
$regexFilter | string | |
Find files in the current path optionally recursing into sub directories.
public find(string $pattern, bool $showHidden, bool $caseSensitive = true, ?int $depth): void
| Parameter | Type | Description |
|---|
$pattern | string | The pattern to match against. This can be either a wildcard string, such as "*.txt" or a regex pattern. Regex is detected if the string is longer than a single character and first character is the same as the last. |
$showHidden | bool | |
$caseSensitive | bool | if TRUE character case will be honoured |
$depth | int | Recursion depth. NULL will always recurse. 0 will prevent recursion. |
public copyTo(string $target, bool $recursive, \Closure $transportCallback): bool
| Parameter | Type | Description |
|---|
$target | string | |
$recursive | bool | |
$transportCallback | \Closure | |
public get(string $child, bool $forceDir): File
| Parameter | Type | Description |
|---|
$child | string | |
$forceDir | bool | |
public getDir(string $path): Dir
| Parameter | Type | Description |
|---|
$path | string | |
public mimeContentType(): string
public dir(?string $child): Dir
| Parameter | Type | Description |
|---|
$child | string | |
Copy a file object into the current directory.
public put(File $file, bool $overwrite): File
| Parameter | Type | Description |
|---|
$file | File | The file to put in this directory |
$overwrite | bool | |
Download a file from a URL directly to the directory and return a new File object.
public download(mixed $sourceUrl, int $timeout = 60): void
This is useful for download large files as this method will write the file directly to storage. Currently, only local storage is supported as this uses OS file access.
| Parameter | Type | Description |
|---|
$sourceUrl | mixed | The source URL of the file to download |
$timeout | int | The download timeout after which an exception will be thrown |
public mediaURL(URL $setPath): ?URL
| Parameter | Type | Description |
|---|
$setPath | URL | |
public sync(Dir $source, bool $recursive, \Closure $progressCallback, int $maxRetries = 3): bool
| Parameter | Type | Description |
|---|
$source | Dir | |
$recursive | bool | |
$progressCallback | \Closure | |
$maxRetries | int | |
public write(string $file, string $bytes, ?string $contentType): ?int
| Parameter | Type | Description |
|---|
$file | string | |
$bytes | string | |
$contentType | string | |
private callSyncCallback(): bool
Generated by Hazaar API Doc Generator on Mon, 27 Oct 2025 13:01:29 +0000