Events

This extension comes up with two different categories of PSR-14 Events you can listen to. The first category deals with the generation of token and payload, the second one with the retrieval of assets.

File Retrieving

These events are executed in the FileDelivery class.

Output Initialization

This event is executed after the JSON Web Token has been decoded and before the access checks take place. The name of the event is Leuchtfeuer\SecureDownloads\Resource\Event\OutputInitializationEvent.

Property

token

Data Type

AbstractToken

Description

This property contains the decoded token object. You can manipulate the properties. The edited token is then used in the further process.

After File Retrieved

This event is executed after the access checks has been performed and both the file and the file name have been read from the token. Afterwards, the check is made whether the file is available on the file system. The name of the event is Leuchtfeuer\SecureDownloads\Resource\Event\AfterFileRetrievedEvent.

Property

file

Data Type

string

Description

Contains the absolute path to the file on the file system. You can change this property.

Property

fileName

Data Type

string

Description

Contains the name of the file. You can change this so that another file name is used when downloading this file.

Before Read Deliver

This event is executed just before the file is sent to the browser. It is the last chance to influence both the output function and the headers sent. The name of the event is Leuchtfeuer\SecureDownloads\Resource\Event\BeforeReadDeliverEvent.

Property

outputFunction (deprecated)

Data Type

string

Description

Contains the output function as string. This property is deprecated and will be removed in further releases since the output function can only be one of x-accel-redirect or stream.

Property

header

Data Type

array

Description

An array of header which will be sent to the browser. You can add your own headers or remove default ones.

Property

fileName

Data Type

string

Description

The name of the file. This property is read-only.

Property

mimeType

Data Type

string

Description

The mime type of the file. This property is read-only.

Property

forceDownload

Data Type

boolean

Description

Information whether the file should be forced to download or not. This property is read-only.