Storage
in package
implements
StorageInterface
Storage module class
Table of Contents
Interfaces
- StorageInterface
- Storage interface
Constants
- RECYCLE_BIN_PATH = 'bin' . DIRECTORY_SEPARATOR
- ROOT_FILESYSTEM_NAME = 'storage'
- USER_FILESYSTEM_NAME = 'user-storage'
Properties
- $errorMessage : string|null
- Error message
- $localFilesystems : array<string|int, mixed>
- Local filesystem names
- $systemDir : array<string|int, mixed>
- System directories
- $manager : MountManager
- Mount manager obj ref
Methods
- __construct() : mixed
- Constructor
- boot() : void
- Boot module
- copy() : bool
- Copy files
- createDir() : bool
- Create directory in storage folder
- delete() : bool
- Delete file from storage folder
- deleteDir() : bool
- Delete directory in storage folder
- deleteFiles() : void
- Delete all files in direcotry (recursive)
- get() : FilesystemInterface|null
- Get filesystem
- getFullPath() : string
- Get full file path
- getMessage() : string|null
- Get error
- getMetadata() : array<string|int, mixed>|false
- Get file info
- getMimetype() : string|false
- Get Mimetypes
- getPublicPath() : string
- Get pubic path
- getRecyleBinPath() : string
- Get recycle bin path
- getRootFilesystemName() : string
- Get root filesystem name
- getSize() : int|false
- Get file size
- getStorageRelativePath() : string
- Get relative storage path
- getSystemDirectories() : array<string|int, mixed>
- Get sytem directories
- has() : bool
- Return true if file exist
- install() : bool
- Install module
- isDir() : bool
- Return true if file is directory
- isEmpty() : bool
- Return true if directory is empty
- isLocalFilesystem() : bool
- Return true if filesystem is local
- isSystemDir() : bool
- Return true if path is system dir
- listContents() : array<string|int, mixed>|false
- Get directory contents
- manager() : MountManager
- Get Mount Manager
- mount() : MountManager|false
- Mount filesystem
- mountFilesystem() : bool
- Mount filesystem
- mountLocal() : MountManager|false
- Mount local filesystem
- moveFile() : bool
- Move file
- moveFiles() : void
- Move all files (recursive)
- read() : string|false
- Read file
- readStream() : resource|false
- Read file as a stream
- rename() : bool
- Rename files
- update() : bool
- Update files
- updateStream() : bool
- Update files using a stream
- write() : bool
- Write files
- writeStream() : bool
- Write file stream
Constants
RECYCLE_BIN_PATH
public
mixed
RECYCLE_BIN_PATH
= 'bin' . DIRECTORY_SEPARATOR
ROOT_FILESYSTEM_NAME
public
mixed
ROOT_FILESYSTEM_NAME
= 'storage'
USER_FILESYSTEM_NAME
public
mixed
USER_FILESYSTEM_NAME
= 'user-storage'
Properties
$errorMessage
Error message
protected
string|null
$errorMessage
= null
$localFilesystems
Local filesystem names
protected
array<string|int, mixed>
$localFilesystems
= ['storage', 'user-storage']
$systemDir
System directories
protected
array<string|int, mixed>
$systemDir
= ['backup', 'public', 'repository', 'temp', 'bin']
$manager
Mount manager obj ref
private
MountManager
$manager
Methods
__construct()
Constructor
public
__construct() : mixed
boot()
Boot module
public
boot() : void
copy()
Copy files
public
copy(string $from, string $to[, string|null $fileSystemName = null ]) : bool
Parameters
- $from : string
- $to : string
- $fileSystemName : string|null = null
Return values
boolcreateDir()
Create directory in storage folder
public
createDir(string $path[, string|null $fileSystemName = null ]) : bool
Parameters
- $path : string
- $fileSystemName : string|null = null
Return values
booldelete()
Delete file from storage folder
public
delete(string $path[, string|null $fileSystemName = null ]) : bool
Parameters
- $path : string
- $fileSystemName : string|null = null
Return values
booldeleteDir()
Delete directory in storage folder
public
deleteDir(string $path[, string|null $fileSystemName = null ]) : bool
Parameters
- $path : string
- $fileSystemName : string|null = null
Return values
booldeleteFiles()
Delete all files in direcotry (recursive)
public
deleteFiles(string $path[, string|null $fileSystemName = null ]) : void
Parameters
- $path : string
- $fileSystemName : string|null = null
get()
Get filesystem
public
get(string $name) : FilesystemInterface|null
Parameters
- $name : string
Return values
FilesystemInterface|nullgetFullPath()
Get full file path
public
getFullPath([string $path = '' ][, string|null $fileSystemName = null ]) : string
Parameters
- $path : string = ''
- $fileSystemName : string|null = null
Return values
stringgetMessage()
Get error
public
getMessage() : string|null
Return values
string|nullgetMetadata()
Get file info
public
getMetadata(string $path[, string|null $fileSystemName = null ]) : array<string|int, mixed>|false
Parameters
- $path : string
- $fileSystemName : string|null = null
Return values
array<string|int, mixed>|falsegetMimetype()
Get Mimetypes
public
getMimetype(string $path[, string|null $fileSystemName = null ]) : string|false
Parameters
- $path : string
- $fileSystemName : string|null = null
Return values
string|falsegetPublicPath()
Get pubic path
public
getPublicPath([bool $relative = false ]) : string
Parameters
- $relative : bool = false
Return values
stringgetRecyleBinPath()
Get recycle bin path
public
getRecyleBinPath() : string
Return values
stringgetRootFilesystemName()
Get root filesystem name
public
getRootFilesystemName() : string
Return values
stringgetSize()
Get file size
public
getSize(string $path[, string|null $fileSystemName = null ]) : int|false
Parameters
- $path : string
- $fileSystemName : string|null = null
Return values
int|falsegetStorageRelativePath()
Get relative storage path
public
getStorageRelativePath([bool $public = false ]) : string
Parameters
- $public : bool = false
Return values
stringgetSystemDirectories()
Get sytem directories
public
getSystemDirectories() : array<string|int, mixed>
Return values
array<string|int, mixed>has()
Return true if file exist
public
has(string $path[, string|null $fileSystemName = null ]) : bool
Parameters
- $path : string
- $fileSystemName : string|null = null
Return values
boolinstall()
Install module
public
install() : bool
Return values
boolisDir()
Return true if file is directory
public
isDir(string $path[, string|null $fileSystemName = null ]) : bool
Parameters
- $path : string
- $fileSystemName : string|null = null
Return values
boolisEmpty()
Return true if directory is empty
public
isEmpty(string $path[, string|null $fileSystemName = null ]) : bool
Parameters
- $path : string
- $fileSystemName : string|null = null
Return values
boolisLocalFilesystem()
Return true if filesystem is local
public
isLocalFilesystem(string|null $name) : bool
Parameters
- $name : string|null
Return values
boolisSystemDir()
Return true if path is system dir
public
isSystemDir(string $path[, string|null $fileSystemName = null ]) : bool
Parameters
- $path : string
- $fileSystemName : string|null = null
Return values
boollistContents()
Get directory contents
public
listContents([string $path = '' ][, bool $recursive = false ][, string|null $fileSystemName = null ]) : array<string|int, mixed>|false
Parameters
- $path : string = ''
- $recursive : bool = false
- $fileSystemName : string|null = null
Return values
array<string|int, mixed>|falsemanager()
Get Mount Manager
public
manager() : MountManager
Return values
MountManagermount()
Mount filesystem
public
mount(string $name, object|string $adapter) : MountManager|false
Parameters
- $name : string
- $adapter : object|string
-
Adapter object or driver name
Return values
MountManager|falsemountFilesystem()
Mount filesystem
public
mountFilesystem(string $name, Filesystem $filesystem) : bool
Parameters
- $name : string
- $filesystem : Filesystem
Return values
boolmountLocal()
Mount local filesystem
public
mountLocal(string $name[, string|null $path = null ]) : MountManager|false
Parameters
- $name : string
- $path : string|null = null
Return values
MountManager|falsemoveFile()
Move file
public
moveFile(string $from, string $to[, string|null $fileSystemName = null ]) : bool
Parameters
- $from : string
- $to : string
- $fileSystemName : string|null = null
Return values
boolmoveFiles()
Move all files (recursive)
public
moveFiles(string $from, string $to[, string|null $fileSystemName = null ]) : void
Parameters
- $from : string
- $to : string
- $fileSystemName : string|null = null
read()
Read file
public
read(string $path[, string|null $fileSystemName = null ]) : string|false
Parameters
- $path : string
- $fileSystemName : string|null = null
Return values
string|falsereadStream()
Read file as a stream
public
readStream(string $path[, string|null $fileSystemName = null ]) : resource|false
Parameters
- $path : string
- $fileSystemName : string|null = null
Return values
resource|falserename()
Rename files
public
rename(string $from, string $to[, string|null $fileSystemName = null ]) : bool
Parameters
- $from : string
- $to : string
- $fileSystemName : string|null = null
Return values
boolupdate()
Update files
public
update(string $path, string $contents[, array<string|int, mixed> $config = [] ][, string|null $fileSystemName = null ]) : bool
Parameters
- $path : string
- $contents : string
- $config : array<string|int, mixed> = []
- $fileSystemName : string|null = null
Return values
boolupdateStream()
Update files using a stream
public
updateStream(string $path, mixed $resource[, array<string|int, mixed> $config = [] ][, string|null $fileSystemName = null ]) : bool
Parameters
- $path : string
- $resource : mixed
- $config : array<string|int, mixed> = []
- $fileSystemName : string|null = null
Return values
boolwrite()
Write files
public
write(string $path, string $contents[, array<string|int, mixed> $config = [] ][, string|null $fileSystemName = null ]) : bool
Parameters
- $path : string
- $contents : string
- $config : array<string|int, mixed> = []
- $fileSystemName : string|null = null
Return values
boolwriteStream()
Write file stream
public
writeStream(string $path, resource $resource[, array<string|int, mixed> $config = [] ][, string|null $fileSystemName = null ]) : bool
Parameters
- $path : string
- $resource : resource
- $config : array<string|int, mixed> = []
- $fileSystemName : string|null = null