MetaFox

StorageService
in package

Table of Contents

Properties

$diskRepository  : DiskRepositoryInterface
$fileRepository  : FileRepositoryInterface

Methods

__construct()  : mixed
asUploadedFile()  : UploadedFile
attach()  : void
copy()  : StorageFile
createFile()  : StorageFile
deleteAll()  : void
deleteFile()  : void
disk()  : Filesystem
down()  : void
download()  : StreamedResponse
Create a streamed download response for a given file.
get()  : string
Get file content.
getAs()  : string
Get content of storage file to temporary file and return its path.
getByOriginals()  : Collection<string|int, StorageFile>
getExt()  : string|null
getFile()  : StorageFile|null
getMimeType()  : string|null
getOrigin()  : StorageFile
getTarget()  : string
getUrl()  : string|null
getUrls()  : array<string|int, mixed>|null
get list of urls of all variants.
put()  : string|bool
Write the contents of a file.
putFile()  : string|false
Store the uploaded file on the disk.
putFileAs()  : StorageFile
Put a local file to cloud storage.
removeTap()  : void
Create a new storage.
rollDown()  : void
rollUp()  : void
tap()  : void
Create a new storage.
copyFile()  : StorageFile|null

Properties

Methods

asUploadedFile()

public asUploadedFile(mixed $id) : UploadedFile
Parameters
$id : mixed
Return values
UploadedFile

attach()

public attach(array<string|int, mixed> $idMap, mixed $itemId, mixed $itemType) : void
Parameters
$idMap : array<string|int, mixed>
$itemId : mixed
$itemType : mixed

deleteAll()

public deleteAll(mixed $fileId) : void
Parameters
$fileId : mixed
Tags
todo:

Implementation?

deleteFile()

public deleteFile(mixed $fileId, string|null $variant) : void
Parameters
$fileId : mixed
$variant : string|null
Tags
todo:

Implementation?

disk()

public disk(string $name) : Filesystem
Parameters
$name : string
Return values
Filesystem

download()

Create a streamed download response for a given file.

public download(int|StorageFile $file[, string|null $name = null ][, array<string|int, mixed> $headers = [] ]) : StreamedResponse
Parameters
$file : int|StorageFile
$name : string|null = null
$headers : array<string|int, mixed> = []
Return values
StreamedResponse

getAs()

Get content of storage file to temporary file and return its path.

public getAs(int|StorageFile $file) : string
Parameters
$file : int|StorageFile

Storage file id

Return values
string

Path of temporary file.

getExt()

public getExt(int $id) : string|null
Parameters
$id : int
Return values
string|null

getMimeType()

public getMimeType(int $id) : string|null
Parameters
$id : int
Return values
string|null

getTarget()

public getTarget(mixed $diskId) : string
Parameters
$diskId : mixed
Return values
string

getUrl()

public getUrl(mixed $id) : string|null
Parameters
$id : mixed
Return values
string|null

getUrls()

get list of urls of all variants.

public getUrls(int $id) : array<string|int, mixed>|null
Parameters
$id : int
Return values
array<string|int, mixed>|null

put()

Write the contents of a file.

public put(string $storage, string $path, StreamInterface|File|UploadedFile|string|resource $contents[, mixed $options = [] ]) : string|bool
Parameters
$storage : string
$path : string
$contents : StreamInterface|File|UploadedFile|string|resource
$options : mixed = []
Return values
string|bool

putFile()

Store the uploaded file on the disk.

public putFile(string $storage, string $path, File|UploadedFile|string $file[, mixed $options = [] ]) : string|false
Parameters
$storage : string
$path : string
$file : File|UploadedFile|string
$options : mixed = []
Return values
string|false

putFileAs()

Put a local file to cloud storage.

public putFileAs(string $storageId, string $path, string|UploadedFile $file, string $name[, array<string|int, mixed> $extra = [] ][, array<string|int, mixed> $options = ['visibility' => 'public'] ]) : StorageFile
Parameters
$storageId : string

Storage id. Example "photo", "video", "attachment", ...

$path : string

Could storage directory etc: "photo/2012/06/14"

$file : string|UploadedFile

Realpath of local

$name : string

Realpath of

$extra : array<string|int, mixed> = []

Extra information of storage file to storage_files table

$options : array<string|int, mixed> = ['visibility' => 'public']

Storage options, etc: ['visibility'=> 'public']

Return values
StorageFile

removeTap()

Create a new storage.

public removeTap(string $name) : void
Parameters
$name : string
Tags
throws
ValidatorException

rollDown()

public rollDown(mixed $id) : void
Parameters
$id : mixed

rollUp()

public rollUp(mixed $id, mixed $storageId) : void
Parameters
$id : mixed
$storageId : mixed

tap()

Create a new storage.

public tap(string $name[, array<string|int, mixed> $attributes = [] ]) : void
Parameters
$name : string
$attributes : array<string|int, mixed> = []

['name'=>string, 'target_id'=>string]

Tags
throws
ValidatorException

        
On this page

Search results