class Storage implements StorageInterface

Storage module class

Constants

ROOT_FILESYSTEM_NAME

USER_FILESYSTEM_NAME

RECYCLE_BIN_PATH

Properties

protected array $systemDir System directories
protected array $localFilesystems Local filesystem names

Methods

__construct()

Constructor

bool
install()

Install module

void
boot()

Boot module

MountManager|false
mountLocal(string $name, string|null $path = null)

Mount local filesystem

MountManager|false
mount(string $name, object|string $adapter)

Mount filesystem

bool
mountFilesystem(string $name, Filesystem $filesystem)

Mount filesystem

object
get(string $name)

Get filesystem

string
getFullPath(string $path = '', string|null $fileSystemName = null)

Get full file path

array|false
listContents(string $path = '', bool $recursive = false, string|null $fileSystemName = null)

Get directory contents

bool
isEmpty(string $path, string|null $fileSystemName = null)

Return true if directory is empty

bool
write(string $path, string $contents, array $config = [], string|null $fileSystemName = null)

Write files

bool
writeStream(string $path, resource $resource, array $config = [], string|null $fileSystemName = null)

Write file stream

bool
update(string $path, string $contents, array $config = [], string|null $fileSystemName = null)

Update files

bool
updateStream(string $path, $resource, $config = [], string|null $fileSystemName = null)

Update files using a stream

string|false
read(string $path, string|null $fileSystemName = null)

Read file

resource|false
readStream(string $path, string|null $fileSystemName = null)

Read file as a stream

void
deleteFiles(string $path, string|null $fileSystemName = null)

Delete all files in direcotry (recursive)

void
moveFiles(string $from, string $to, string|null $fileSystemName = null)

Move all files (recursive)

boolean
delete(string $path, string|null $fileSystemName = null)

Delete file from storage folder

boolean
rename(string $from, string $to, string|null $fileSystemName = null)

Rename files

boolean
deleteDir(string $path, string|null $fileSystemName = null)

Delete directory in storage folder

boolean
createDir(string $path, string|null $fileSystemName = null)

Create directory in storage folder

boolean
has(string $path, string|null $fileSystemName = null)

Return true if file exist

void
copy(string $from, string $to, string|null $fileSystemName = null)

Copy files

boolean
moveFile(string $from, string $to, string|null $fileSystemName = null)

Move file

array
getMetadata(string $path, string|null $fileSystemName = null)

Get file info

boolean
isDir(string $path, string|null $fileSystemName = null)

Return true if file is directory

string
getMimetype(string $path, string|null $fileSystemName = null)

Get Mimetypes

integer|false
getSize(string $path, string|null $fileSystemName = null)

Get file size

MountManager
manager()

Get Mount Manager

array
getSystemDirectories()

Get sytem directories

boolean
isSystemDir(string $path, string|null $fileSystemName = null)

Return true if path is system dir

boolean
isLocalFilesystem(string|null $name)

Return true if filesystem is local

string
getRootFilesystemName()

Get root filesystem name

string
getRecyleBinPath()

Get recycle bin path

string
getPublicPath(bool $relative = false)

Get pubic path

Details

at line 59
__construct()

Constructor

at line 70
bool install()

Install module

Return Value

bool

at line 87
void boot()

Boot module

Return Value

void

at line 100
MountManager|false mountLocal(string $name, string|null $path = null)

Mount local filesystem

Parameters

string $name
string|null $path

Return Value

MountManager|false

at line 115
MountManager|false mount(string $name, object|string $adapter)

Mount filesystem

Parameters

string $name
object|string $adapter Adapter object or driver name

Return Value

MountManager|false

at line 132
bool mountFilesystem(string $name, Filesystem $filesystem)

Mount filesystem

Parameters

string $name
Filesystem $filesystem

Return Value

bool

at line 143
object get(string $name)

Get filesystem

Parameters

string $name

Return Value

object

at line 155
string getFullPath(string $path = '', string|null $fileSystemName = null)

Get full file path

Parameters

string $path
string|null $fileSystemName

Return Value

string

at line 168
array|false listContents(string $path = '', bool $recursive = false, string|null $fileSystemName = null)

Get directory contents

Parameters

string $path
bool $recursive
string|null $fileSystemName

Return Value

array|false

at line 180
bool isEmpty(string $path, string|null $fileSystemName = null)

Return true if directory is empty

Parameters

string $path
string|null $fileSystemName

Return Value

bool

at line 194
bool write(string $path, string $contents, array $config = [], string|null $fileSystemName = null)

Write files

Parameters

string $path
string $contents
array $config
string|null $fileSystemName

Return Value

bool

at line 214
bool writeStream(string $path, resource $resource, array $config = [], string|null $fileSystemName = null)

Write file stream

Parameters

string $path
resource $resource
array $config
string|null $fileSystemName

Return Value

bool

at line 234
bool update(string $path, string $contents, array $config = [], string|null $fileSystemName = null)

Update files

Parameters

string $path
string $contents
array $config
string|null $fileSystemName

Return Value

bool

at line 248
bool updateStream(string $path, $resource, $config = [], string|null $fileSystemName = null)

Update files using a stream

Parameters

string $path
$resource
$config
string|null $fileSystemName

Return Value

bool

at line 260
string|false read(string $path, string|null $fileSystemName = null)

Read file

Parameters

string $path
string|null $fileSystemName

Return Value

string|false

at line 272
resource|false readStream(string $path, string|null $fileSystemName = null)

Read file as a stream

Parameters

string $path
string|null $fileSystemName

Return Value

resource|false

at line 284
void deleteFiles(string $path, string|null $fileSystemName = null)

Delete all files in direcotry (recursive)

Parameters

string $path
string|null $fileSystemName

Return Value

void

at line 310
void moveFiles(string $from, string $to, string|null $fileSystemName = null)

Move all files (recursive)

Parameters

string $from
string $to
string|null $fileSystemName

Return Value

void

at line 328
boolean delete(string $path, string|null $fileSystemName = null)

Delete file from storage folder

Parameters

string $path
string|null $fileSystemName

Return Value

boolean

at line 341
boolean rename(string $from, string $to, string|null $fileSystemName = null)

Rename files

Parameters

string $from
string $to
string|null $fileSystemName

Return Value

boolean

at line 353
boolean deleteDir(string $path, string|null $fileSystemName = null)

Delete directory in storage folder

Parameters

string $path
string|null $fileSystemName

Return Value

boolean

at line 365
boolean createDir(string $path, string|null $fileSystemName = null)

Create directory in storage folder

Parameters

string $path
string|null $fileSystemName

Return Value

boolean

at line 377
boolean has(string $path, string|null $fileSystemName = null)

Return true if file exist

Parameters

string $path
string|null $fileSystemName

Return Value

boolean

at line 390
void copy(string $from, string $to, string|null $fileSystemName = null)

Copy files

Parameters

string $from
string $to
string|null $fileSystemName

Return Value

void

at line 403
boolean moveFile(string $from, string $to, string|null $fileSystemName = null)

Move file

Parameters

string $from
string $to
string|null $fileSystemName

Return Value

boolean

at line 422
array getMetadata(string $path, string|null $fileSystemName = null)

Get file info

Parameters

string $path
string|null $fileSystemName

Return Value

array

at line 434
boolean isDir(string $path, string|null $fileSystemName = null)

Return true if file is directory

Parameters

string $path
string|null $fileSystemName

Return Value

boolean

at line 453
string getMimetype(string $path, string|null $fileSystemName = null)

Get Mimetypes

Parameters

string $path
string|null $fileSystemName

Return Value

string

at line 465
integer|false getSize(string $path, string|null $fileSystemName = null)

Get file size

Parameters

string $path
string|null $fileSystemName

Return Value

integer|false

at line 475
MountManager manager()

Get Mount Manager

Return Value

MountManager

at line 485
array getSystemDirectories()

Get sytem directories

Return Value

array

at line 497
boolean isSystemDir(string $path, string|null $fileSystemName = null)

Return true if path is system dir

Parameters

string $path
string|null $fileSystemName

Return Value

boolean

at line 510
boolean isLocalFilesystem(string|null $name)

Return true if filesystem is local

Parameters

string|null $name

Return Value

boolean

at line 524
string getRootFilesystemName()

Get root filesystem name

Return Value

string

at line 534
string getRecyleBinPath()

Get recycle bin path

Return Value

string

at line 545
string getPublicPath(bool $relative = false)

Get pubic path

Parameters

bool $relative

Return Value

string