PHP Interface Webiny\Component\Storage\Driver\DriverInterface

Show file Open project: Webiny/Framework Interface Usage Examples

Public Methods

Method Description
createDateFolderStructure ( ) : boolean Does this storage create a date folder structure?
deleteKey ( string $key ) : boolean Deletes the file
getContents ( string $key ) : string | boolean Reads the contents of the file
getKeys ( string $key = '', boolean | integer $recursive = false ) : array Returns an array of all keys (files and directories)
getRecentKey ( ) : string | null Returns most recent file key that was used by a storage
getTimeModified ( string $key ) : integer | boolean Returns the last modified time
getURL ( $key ) : mixed Returns public file URL
keyExists ( string $key ) : boolean Checks whether the file exists
renameKey ( string $sourceKey, string $targetKey ) : boolean Renames a file
setContents ( $key, $contents, boolean $append = false ) : boolean | integer Writes the given File

Method Details

createDateFolderStructure() public method

Does this storage create a date folder structure?

deleteKey() public method

Deletes the file
public deleteKey ( string $key ) : boolean
$key string
return boolean

getContents() public method

Reads the contents of the file
public getContents ( string $key ) : string | boolean
$key string
return string | boolean if cannot read content

getKeys() public method

For storages that do not support directories, both parameters are irrelevant.
public getKeys ( string $key = '', boolean | integer $recursive = false ) : array
$key string (Optional) Key of a directory to get keys from. If not set - keys will be read from the storage root.
$recursive boolean | integer (Optional) Read all items recursively. Pass integer value to specify recursion depth.
return array

getRecentKey() public method

Returns most recent file key that was used by a storage
public getRecentKey ( ) : string | null
return string | null

getTimeModified() public method

Returns the last modified time
public getTimeModified ( string $key ) : integer | boolean
$key string
return integer | boolean A UNIX like timestamp or false

getURL() public method

Returns public file URL
public getURL ( $key ) : mixed
$key
return mixed

keyExists() public method

Checks whether the file exists
public keyExists ( string $key ) : boolean
$key string
return boolean

renameKey() public method

Renames a file
public renameKey ( string $sourceKey, string $targetKey ) : boolean
$sourceKey string
$targetKey string
return boolean

setContents() public method

Writes the given File
public setContents ( $key, $contents, boolean $append = false ) : boolean | integer
$key
$contents
$append boolean
return boolean | integer The number of bytes that were written into the file