FileAccess Orion

Server extends AbstractTus
in package

Table of Contents

TUS_EXTENSION_CHECKSUM  = 'checksum'
TUS_EXTENSION_CONCATENATION  = 'concatenation'
TUS_EXTENSION_CREATION  = 'creation'
TUS_EXTENSION_EXPIRATION  = 'expiration'
TUS_EXTENSION_TERMINATION  = 'termination'
TUS_EXTENSIONS  = [self::TUS_EXTENSION_CREATION, self::TUS_EXTENSION_TERMINATION, self::TUS_EXTENSION_CHECKSUM, self::TUS_EXTENSION_EXPIRATION, self::TUS_EXTENSION_CONCATENATION]
TUS_PROTOCOL_VERSION  = '1.0.0'
UPLOAD_TYPE_FINAL  = 'final'
UPLOAD_TYPE_PARTIAL  = 'partial'
HEADER_CONTENT_TYPE  = 'application/offset+octet-stream'
PARTIAL_UPLOAD_NAME_SEPARATOR  = '_'
UPLOAD_TYPE_NORMAL  = 'normal'
DEFAULT_CHECKSUM_ALGORITHM  = 'sha256'
HTTP_CHECKSUM_MISMATCH  = 460
$apiPath  : string
$cache  : Cacheable
$dispatcher  : EventDispatcherInterface
$maxUploadSize  : int
$middleware  : Middleware
$request  : Request
$response  : Response
$uploadDir  : string
$uploadKey  : string
__call()  : Response
No other methods are allowed.
__construct()  : mixed
TusServer constructor.
event()  : EventDispatcherInterface
Set and get event dispatcher.
getApiPath()  : string
Get API path.
getCache()  : Cacheable
Get cache.
getChecksumAlgorithm()  : string|null
Get checksum algorithm.
getMaxUploadSize()  : int
Get max upload size.
getRequest()  : Request
Get request.
getResponse()  : Response
Get request.
getServerChecksum()  : string
Get file checksum.
getUploadDir()  : string
Get upload dir.
getUploadKey()  : string|Response
Get upload key from header.
handleExpiration()  : array<string|int, mixed>
Delete expired resources.
middleware()  : Middleware
Get middleware.
serve()  : Response|BinaryFileResponse
Handle all HTTP request.
setApiPath()  : self
Set API path.
setCache()  : self
Set cache.
setDispatcher()  : self
Set event dispatcher.
setMaxUploadSize()  : Server
Set max upload size.
setMiddleware()  : self
Set middleware.
setUploadDir()  : Server
Set upload dir.
setUploadKey()  : Server
Set upload key.
applyMiddleware()  : void
Apply middleware.
buildFile()  : File
Build file object.
getClientChecksum()  : string|Response
Verify and get upload checksum from header.
getHeadersForHeadRequest()  : array<string|int, mixed>
Get required headers for head request.
getPartialsMeta()  : array<string|int, mixed>
Get metadata of partials.
getPathForPartialUpload()  : string
Get path for partial upload.
getSupportedHashAlgorithms()  : string
Get list of supported hash algorithms.
handleConcatenation()  : Response
Handle file concatenation.
handleDelete()  : Response
Handle DELETE request.
handleDownload()  : BinaryFileResponse|Response
Handle Download request.
handleGet()  : BinaryFileResponse|Response
Handle GET request.
handleHead()  : Response
Handle HEAD request.
handleOptions()  : Response
Handle OPTIONS request.
handlePatch()  : Response
Handle PATCH request.
handlePost()  : Response
Handle POST request.
isExpired()  : bool
Get expired but incomplete uploads.
verifyChecksum()  : bool
Verify checksum if available.
verifyPatchRequest()  : int
Verify PATCH request.
verifyUploadSize()  : bool
Verify max upload size.

Constants

TUS_EXTENSION_CHECKSUM

public mixed TUS_EXTENSION_CHECKSUM = 'checksum'
Tags
const

string Tus Checksum Extension

TUS_EXTENSION_CONCATENATION

public mixed TUS_EXTENSION_CONCATENATION = 'concatenation'
Tags
const

string Tus Concatenation Extension

TUS_EXTENSION_CREATION

public mixed TUS_EXTENSION_CREATION = 'creation'
Tags
const

string Tus Creation Extension

TUS_EXTENSION_EXPIRATION

public mixed TUS_EXTENSION_EXPIRATION = 'expiration'
Tags
const

string Tus Expiration Extension

TUS_EXTENSION_TERMINATION

public mixed TUS_EXTENSION_TERMINATION = 'termination'
Tags
const

string Tus Termination Extension

TUS_EXTENSIONS

public mixed TUS_EXTENSIONS = [self::TUS_EXTENSION_CREATION, self::TUS_EXTENSION_TERMINATION, self::TUS_EXTENSION_CHECKSUM, self::TUS_EXTENSION_EXPIRATION, self::TUS_EXTENSION_CONCATENATION]
Tags
const

array All supported tus extensions

TUS_PROTOCOL_VERSION

public mixed TUS_PROTOCOL_VERSION = '1.0.0'
Tags
const

string Tus protocol version.

UPLOAD_TYPE_FINAL

public mixed UPLOAD_TYPE_FINAL = 'final'
Tags
const

string Upload type final.

UPLOAD_TYPE_PARTIAL

public mixed UPLOAD_TYPE_PARTIAL = 'partial'
Tags
const

string Upload type partial.

HEADER_CONTENT_TYPE

protected mixed HEADER_CONTENT_TYPE = 'application/offset+octet-stream'
Tags
const

string Header Content Type

PARTIAL_UPLOAD_NAME_SEPARATOR

protected mixed PARTIAL_UPLOAD_NAME_SEPARATOR = '_'
Tags
const

string Name separator for partial upload.

UPLOAD_TYPE_NORMAL

protected mixed UPLOAD_TYPE_NORMAL = 'normal'
Tags
const

string Upload type normal.

DEFAULT_CHECKSUM_ALGORITHM

private mixed DEFAULT_CHECKSUM_ALGORITHM = 'sha256'
Tags
const

string Default checksum algorithm

HTTP_CHECKSUM_MISMATCH

private mixed HTTP_CHECKSUM_MISMATCH = 460
Tags
const

int 460 Checksum Mismatch

Properties

$maxUploadSize

protected int $maxUploadSize = 0

Max upload size in bytes Default 0, no restriction.

$uploadDir

protected string $uploadDir

$uploadKey

protected string $uploadKey

Methods

__call()

No other methods are allowed.

public __call(string $method, array<string|int, mixed> $params) : Response
Parameters
$method : string
$params : array<string|int, mixed>
Return values
Response

__construct()

TusServer constructor.

public __construct([Cacheable|string $cacheAdapter = 'file' ]) : mixed
Parameters
$cacheAdapter : Cacheable|string = 'file'
Tags
throws
ReflectionException
Return values
mixed

getApiPath()

Get API path.

public getApiPath() : string
Return values
string

getChecksumAlgorithm()

Get checksum algorithm.

public getChecksumAlgorithm() : string|null
Return values
string|null

getMaxUploadSize()

Get max upload size.

public getMaxUploadSize() : int
Return values
int

getServerChecksum()

Get file checksum.

public getServerChecksum(string $filePath) : string
Parameters
$filePath : string
Return values
string

getUploadDir()

Get upload dir.

public getUploadDir() : string
Return values
string

getUploadKey()

Get upload key from header.

public getUploadKey() : string|Response
Return values
string|Response

handleExpiration()

Delete expired resources.

public handleExpiration() : array<string|int, mixed>
Return values
array<string|int, mixed>

setApiPath()

Set API path.

public setApiPath(string $path) : self
Parameters
$path : string
Return values
self

setCache()

Set cache.

public setCache(mixed $cache) : self
Parameters
$cache : mixed
Tags
throws
ReflectionException
Return values
self

setMaxUploadSize()

Set max upload size.

public setMaxUploadSize(int $uploadSize) : Server
Parameters
$uploadSize : int
Return values
Server

setMiddleware()

Set middleware.

public setMiddleware(Middleware $middleware) : self
Parameters
$middleware : Middleware
Return values
self

setUploadDir()

Set upload dir.

public setUploadDir(string $path) : Server
Parameters
$path : string
Return values
Server

setUploadKey()

Set upload key.

public setUploadKey(string $key) : Server
Parameters
$key : string
Return values
Server

applyMiddleware()

Apply middleware.

protected applyMiddleware() : void
Return values
void

buildFile()

Build file object.

protected buildFile(array<string|int, mixed> $meta) : File
Parameters
$meta : array<string|int, mixed>
Return values
File

getClientChecksum()

Verify and get upload checksum from header.

protected getClientChecksum() : string|Response
Return values
string|Response

getHeadersForHeadRequest()

Get required headers for head request.

protected getHeadersForHeadRequest(array<string|int, mixed> $fileMeta) : array<string|int, mixed>
Parameters
$fileMeta : array<string|int, mixed>
Return values
array<string|int, mixed>

getPartialsMeta()

Get metadata of partials.

protected getPartialsMeta(array<string|int, mixed> $partials) : array<string|int, mixed>
Parameters
$partials : array<string|int, mixed>
Return values
array<string|int, mixed>

getPathForPartialUpload()

Get path for partial upload.

protected getPathForPartialUpload(string $key) : string
Parameters
$key : string
Return values
string

getSupportedHashAlgorithms()

Get list of supported hash algorithms.

protected getSupportedHashAlgorithms() : string
Return values
string

handleConcatenation()

Handle file concatenation.

protected handleConcatenation(string $fileName, string $filePath) : Response
Parameters
$fileName : string
$filePath : string
Return values
Response

handleGet()

Handle GET request.

protected handleGet() : BinaryFileResponse|Response

As per RFC7231, we need to treat HEAD and GET as an identical request. All major PHP frameworks follows the same and silently transforms each HEAD requests to GET.

Return values
BinaryFileResponse|Response

isExpired()

Get expired but incomplete uploads.

protected isExpired(array<string|int, mixed>|null $contents) : bool
Parameters
$contents : array<string|int, mixed>|null
Return values
bool

verifyChecksum()

Verify checksum if available.

protected verifyChecksum(string $checksum, string $filePath) : bool
Parameters
$checksum : string
$filePath : string
Return values
bool

verifyPatchRequest()

Verify PATCH request.

protected verifyPatchRequest(array<string|int, mixed> $meta) : int
Parameters
$meta : array<string|int, mixed>
Return values
int

verifyUploadSize()

Verify max upload size.

protected verifyUploadSize() : bool
Return values
bool

Search results