Local
Local
Represent local.
class Local implements \Hazaar\File\Interface\Backend , \Hazaar\File\Interface\DriverImplements: Hazaar\File\Interface\Backend, Hazaar\File\Interface\Driver
Properties
separator
Store the separator.
public string $separator = 'DIRECTORY_SEPARATOR'Type: string
options
private Options $optionsType: Hazaar\File\Backend\Local\Options
meta
private array $metaType: array
Methods
__construct
Create a new instance.
public __construct(array|Options $options): voidParameters
| Parameter | Type | Description |
|---|---|---|
$options | array | Hazaar\File\Backend\Local\Options |
label
Return the human-readable label for this backend implementation.
public label(): stringReturns: string
refresh
Refresh the remote authorization token used by this backend.
public refresh(bool $reset): boolReturns: bool
Parameters
| Parameter | Type | Description |
|---|---|---|
$reset | bool |
resolvePath
Resolve path.
public resolvePath(string $path, ?string $file): stringReturns: string
Parameters
| Parameter | Type | Description |
|---|---|---|
$path | string | |
$file | string |
scandir
Get a directory listing.
public scandir(string $path, ?string $regexFilter, int $sort = 'SCANDIR_SORT_ASCENDING', bool $showHidden, ?string $relativePath): array|boolReturns: array|bool
Parameters
| Parameter | Type | Description |
|---|---|---|
$path | string | |
$regexFilter | string | |
$sort | int | |
$showHidden | bool | |
$relativePath | string |
read
Read and return file contents from backend storage.
public read(string $file, int $offset = -1, ?int $maxlen): false|stringReturns: false|string
Parameters
| Parameter | Type | Description |
|---|---|---|
$file | string | |
$offset | int | |
$maxlen | int |
write
Write content to a backend path and return bytes written.
public write(string $file, string $data, ?string $contentType, bool $overwrite = true): ?intReturns: int
Parameters
| Parameter | Type | Description |
|---|---|---|
$file | string | |
$data | string | |
$contentType | string | |
$overwrite | bool |
upload
public upload(string $path, array $file, bool $overwrite = true): boolReturns: bool
Parameters
| Parameter | Type | Description |
|---|---|---|
$path | string | |
$file | array | |
$overwrite | bool |
copy
Copy a file or directory within backend storage.
public copy(string $src, string $dst, bool $overwrite): boolReturns: bool
Parameters
| Parameter | Type | Description |
|---|---|---|
$src | string | |
$dst | string | |
$overwrite | bool |
link
Create a link or alias to a backend object when supported.
public link(string $src, string $dst): boolReturns: bool
Parameters
| Parameter | Type | Description |
|---|---|---|
$src | string | |
$dst | string |
move
Move or rename a backend object.
public move(string $src, string $dst): boolReturns: bool
Parameters
| Parameter | Type | Description |
|---|---|---|
$src | string | |
$dst | string |
unlink
Delete a file at the supplied backend path.
public unlink(string $path): boolReturns: bool
Parameters
| Parameter | Type | Description |
|---|---|---|
$path | string |
mimeContentType
Mime content type.
public mimeContentType(string $path): ?stringReturns: string
Parameters
| Parameter | Type | Description |
|---|---|---|
$path | string |
md5Checksum
Md5 checksum.
public md5Checksum(string $path): ?stringReturns: string
Parameters
| Parameter | Type | Description |
|---|---|---|
$path | string |
mkdir
Makes directory.
public mkdir(string $path): boolReturns: bool
Parameters
| Parameter | Type | Description |
|---|---|---|
$path | string |
rmdir
Removes directory.
public rmdir(string $path, bool $recurse): boolReturns: bool
Parameters
| Parameter | Type | Description |
|---|---|---|
$path | string | |
$recurse | bool |
exists
Checks whether a file or directory exists.
public exists(string $path): boolReturns: bool
Parameters
| Parameter | Type | Description |
|---|---|---|
$path | string |
realpath
Returns canonicalized absolute pathname.
public realpath(string $path): stringReturns: string
Parameters
| Parameter | Type | Description |
|---|---|---|
$path | string |
isReadable
true if path is a readable.
public isReadable(string $path): boolReturns: bool
Parameters
| Parameter | Type | Description |
|---|---|---|
$path | string |
isWritable
true if path is writable.
public isWritable(string $path): boolReturns: bool
Parameters
| Parameter | Type | Description |
|---|---|---|
$path | string |
isDir
true if path is a directory.
public isDir(string $path): boolReturns: bool
Parameters
| Parameter | Type | Description |
|---|---|---|
$path | string |
isLink
true if path is a symlink.
public isLink(string $path): boolReturns: bool
Parameters
| Parameter | Type | Description |
|---|---|---|
$path | string |
isFile
true if path is a normal file.
public isFile(string $path): boolReturns: bool
Parameters
| Parameter | Type | Description |
|---|---|---|
$path | string |
filetype
Returns the file type.
public filetype(string $path): stringReturns: string
Parameters
| Parameter | Type | Description |
|---|---|---|
$path | string |
filectime
Returns the file create time.
public filectime(string $path): intReturns: int
Parameters
| Parameter | Type | Description |
|---|---|---|
$path | string |
filemtime
Returns the file modification time.
public filemtime(string $path): intReturns: int
Parameters
| Parameter | Type | Description |
|---|---|---|
$path | string |
touch
Sets access and modification time of file.
public touch(string $path): boolReturns: bool
Parameters
| Parameter | Type | Description |
|---|---|---|
$path | string |
fileatime
Return the last-access timestamp for a backend path.
public fileatime(string $path): intReturns: int
Parameters
| Parameter | Type | Description |
|---|---|---|
$path | string |
filesize
Return the file size in bytes for a backend path.
public filesize(string $path): intReturns: int
Parameters
| Parameter | Type | Description |
|---|---|---|
$path | string |
fileperms
Return permission metadata for a backend path when available.
public fileperms(string $path): intReturns: int
Parameters
| Parameter | Type | Description |
|---|---|---|
$path | string |
chmod
Update permission metadata for a backend path when supported.
public chmod(string $path, int $mode): boolReturns: bool
Parameters
| Parameter | Type | Description |
|---|---|---|
$path | string | |
$mode | int |
chown
Update owner metadata for a backend path when supported.
public chown(string $path, string $user): boolReturns: bool
Parameters
| Parameter | Type | Description |
|---|---|---|
$path | string | |
$user | string |
chgrp
Update group metadata for a backend path when supported.
public chgrp(string $path, string $group): boolReturns: bool
Parameters
| Parameter | Type | Description |
|---|---|---|
$path | string | |
$group | string |
cwd
Return the current working directory for this backend.
public cwd(): stringReturns: string
setMeta
public setMeta(string $path, array $values): boolReturns: bool
Parameters
| Parameter | Type | Description |
|---|---|---|
$path | string | |
$values | array |
getMeta
public getMeta(string $path, ?string $key): array|stringReturns: array|string
Parameters
| Parameter | Type | Description |
|---|---|---|
$path | string | |
$key | string |
previewURL
public previewURL(string $path, array $params): false|stringReturns: false|string
Parameters
| Parameter | Type | Description |
|---|---|---|
$path | string | |
$params | array |
directURL
Direct u r l.
public directURL(string $path): false|stringReturns: false|string
Parameters
| Parameter | Type | Description |
|---|---|---|
$path | string |
authorise
Run the authorization flow required by the remote backend service.
public authorise(?string $redirectUri): boolReturns: bool
Parameters
| Parameter | Type | Description |
|---|---|---|
$redirectUri | string |
authoriseWithCode
Authorise with code.
public authoriseWithCode(string $code, ?string $redirectUri, string $grantType = 'authorization_code', array $options): boolReturns: bool
Parameters
| Parameter | Type | Description |
|---|---|---|
$code | string | |
$redirectUri | string | |
$grantType | string | |
$options | array |
authorised
Check whether this backend currently has valid authorization credentials.
public authorised(): boolReturns: bool
buildAuthURL
Build auth u r l.
public buildAuthURL(?string $callbackUrl): ?stringReturns: string
Parameters
| Parameter | Type | Description |
|---|---|---|
$callbackUrl | string |
thumbnailURL
Thumbnail u r l.
public thumbnailURL(string $path, int $width = 100, int $height = 100, string $format = 'jpeg', array $params): false|stringReturns: false|string
Parameters
| Parameter | Type | Description |
|---|---|---|
$path | string | |
$width | int | |
$height | int | |
$format | string | |
$params | array |
openStream
Open stream.
public openStream(string $path, string $mode): mixedReturns: mixed
Parameters
| Parameter | Type | Description |
|---|---|---|
$path | string | |
$mode | string |
writeStream
public writeStream(resource $stream, string $bytes, ?int $length): intReturns: int
Parameters
| Parameter | Type | Description |
|---|---|---|
$stream | resource | |
$bytes | string | |
$length | int |
readStream
public readStream(resource $stream, int $length): false|stringReturns: false|string
Parameters
| Parameter | Type | Description |
|---|---|---|
$stream | resource | |
$length | int |
seekStream
public seekStream(mixed $stream, int $offset, int $whence = 'SEEK_SET'): intReturns: int
Parameters
| Parameter | Type | Description |
|---|---|---|
$stream | mixed | |
$offset | int | |
$whence | int |
tellStream
public tellStream(mixed $stream): false|intReturns: false|int
Parameters
| Parameter | Type | Description |
|---|---|---|
$stream | mixed |
eofStream
public eofStream(mixed $stream): boolReturns: bool
Parameters
| Parameter | Type | Description |
|---|---|---|
$stream | mixed |
truncateStream
public truncateStream(mixed $stream, int $size): boolReturns: bool
Parameters
| Parameter | Type | Description |
|---|---|---|
$stream | mixed | |
$size | int |
lockStream
public lockStream(mixed $stream, int $operation, ?int $wouldblock): boolReturns: bool
Parameters
| Parameter | Type | Description |
|---|---|---|
$stream | mixed | |
$operation | int | |
$wouldblock | int |
flushStream
public flushStream(mixed $stream): boolReturns: bool
Parameters
| Parameter | Type | Description |
|---|---|---|
$stream | mixed |
getsStream
public getsStream(mixed $stream, ?int $length): false|stringReturns: false|string
Parameters
| Parameter | Type | Description |
|---|---|---|
$stream | mixed | |
$length | int |
closeStream
public closeStream(resource $stream): boolReturns: bool
Parameters
| Parameter | Type | Description |
|---|---|---|
$stream | resource |
find
Search backend storage for entries matching the supplied pattern.
public find(?string $search, string $path = '/', bool $caseInsensitive): array|falseReturns: array|false
Parameters
| Parameter | Type | Description |
|---|---|---|
$search | string | |
$path | string | |
$caseInsensitive | bool |
fsck
Run a backend consistency check and return diagnostic results.
public fsck(bool $skipRoot_reload): boolReturns: bool
Parameters
| Parameter | Type | Description |
|---|---|---|
$skipRoot_reload | bool |
meta
Execute the meta operation for this file component.
private meta(string $fullpath): BTreeReturns: Hazaar\Util\BTree
Parameters
| Parameter | Type | Description |
|---|---|---|
$fullpath | string |
Generated by Hazaar API Doc Generator on Fri, 04 Sep 2026 23:32:17 +0000