DataStream
FlowStreamedResponse builder.
Methods
- __construct() : mixed
- as() : self
- Set the filename for the response.
- headers() : self
- Set additional headers.
- open() : self
- response() : FlowBufferedResponse
- Create regular response where whole dataset is loaded into the memory.
- status() : self
- Set the HTTP status code. Default is 200.
- streamedResponse() : FlowStreamedResponse
- Send the data stream to the output.
- transform() : self
- Apply transformations to the data stream.
- withoutHeader() : self
- Remove a specific header if it exists.
Methods
__construct()
public
__construct(Extractor $extractor) : mixed
Parameters
- $extractor : Extractor
as()
Set the filename for the response.
public
as(string $name[, bool $attachment = true ]) : self
If the attachment flag is set to true, the response will be treated as an attachment meaning that the browser will prompt the user to download the file.
Parameters
- $name : string
- $attachment : bool = true
Return values
selfheaders()
Set additional headers.
public
headers(array<string|int, mixed> $headers) : self
Headers are merged with the default headers.
Parameters
- $headers : array<string|int, mixed>
Return values
selfopen()
public
static open(Extractor $extractor) : self
Parameters
- $extractor : Extractor
Return values
selfresponse()
Create regular response where whole dataset is loaded into the memory.
public
response(Output $output) : FlowBufferedResponse
It's highly recommended to use limit transformation to avoid loading entire dataset into the memory. Some extractors like Parquet/Elasticsearch/Doctrine allows also for setting offset directly on the extractor.
Parameters
- $output : Output
Return values
FlowBufferedResponsestatus()
Set the HTTP status code. Default is 200.
public
status(int $status) : self
Parameters
- $status : int
Return values
selfstreamedResponse()
Send the data stream to the output.
public
streamedResponse(Output $output) : FlowStreamedResponse
Parameters
- $output : Output
Return values
FlowStreamedResponsetransform()
Apply transformations to the data stream.
public
transform(Transformation ...$transformations) : self
Transformations are applied in the order they are passed. Transformations are applied on the fly, while streaming the data, this means that any resource expensive transformations like for example aggregations or sorting might significantly slow down the streaming process or even cause out of memory errors.
Parameters
- $transformations : Transformation
Return values
selfwithoutHeader()
Remove a specific header if it exists.
public
withoutHeader(string $name) : self
If the header does not exist, nothing happens.
Parameters
- $name : string