Properties

$directory

$directory : string

Type

string

$recentKey

$recentKey : null

the last interacted key

Type

null

$publicUrl

$publicUrl : 

Public url

Type

Methods

__construct()

__construct(  $config) 

LocalStorageDriver constructor.

Parameters

$config

keyExists()

keyExists(string  $key) : boolean

Check if file/key exists

Parameters

string $key

Returns

boolean

getSize()

getSize(  $key) : integer

Get file size

Parameters

$key

Returns

integer

getContents()

getContents(string  $key) : string|boolean

Reads the contents of the file

Parameters

string $key

Returns

string|boolean —

if cannot read content

setContents()

setContents(  $key,   $contents, boolean  $append = false) : boolean|integer

Writes the given File

Parameters

$key
$contents
boolean $append

Returns

boolean|integer —

The number of bytes that were written into the file

getKeys()

getKeys(string  $key = '', boolean|integer  $recursive = false) : array

Returns an array of all keys (files and directories)

For storages that do not support directories, both parameters are irrelevant.

Parameters

string $key

(Optional) Key of a directory to get keys from. If not set - keys will be read from the storage root.

boolean|integer $recursive

(Optional) Read all items recursively. Pass integer value to specify recursion depth.

Returns

array

getTimeModified()

getTimeModified(string  $key) : integer|boolean

Returns the last modified time

Parameters

string $key

Returns

integer|boolean —

A UNIX like timestamp or false

deleteKey()

deleteKey(string  $key) : boolean

Deletes the file

Parameters

string $key

Returns

boolean

renameKey()

renameKey(string  $sourceKey, string  $targetKey) : true

Renames a file

Parameters

string $sourceKey
string $targetKey

Returns

true —

if succeeds

getRecentKey()

getRecentKey() : string|null

Returns most recent file key that was used by a storage

Returns

string|null

getURL()

getURL(  $key) : mixed

Returns public file URL

Parameters

$key

Returns

mixed

createDateFolderStructure()

createDateFolderStructure() : boolean

Does this storage create a date folder structure? TODO: fix missing dateFolderStructure variable

Returns

boolean

getAbsolutePath()

getAbsolutePath(  $key) : mixed

To get the absolute path

Parameters

$key

Returns

mixed

touchKey()

touchKey(  $key) : mixed

Touch a file (change time modified)

Parameters

$key

Returns

mixed

isDirectory()

isDirectory(string  $key) : boolean

Check if key is directory

Parameters

string $key

Returns

boolean

buildPath()

buildPath(  $key) : mixed

Build path or throw exception

Parameters

$key

Returns

mixed