CsvExportService
in package
Standardized CSV export for query results, entity collections, and arrays.
Uses php://temp streams for memory efficiency. Returns Response objects with proper download headers.
Table of Contents
Methods
- outputCsv() : Response
- Generate CSV response from data source.
Methods
outputCsv()
Generate CSV response from data source.
public
outputCsv(QueryInterface|iterable<string|int, mixed> $data[, string $filename = 'export.csv' ][, array<string|int, mixed>|null $headers = null ]) : Response
Uses php://temp streams for memory efficiency. Returns Response with download headers.
Parameters
- $data : QueryInterface|iterable<string|int, mixed>
-
Source data (query, array, or iterable)
- $filename : string = 'export.csv'
-
Desired filename for download
- $headers : array<string|int, mixed>|null = null
-
Optional explicit column headers
Return values
Response —HTTP response configured for CSV download