LimeSurvey API - Master branch

ExportWriterInterface

Table of Contents

Methods

export()  : array<string|int, mixed>
Export survey responses to the specified format.
finalize()  : array<string|int, mixed>
Finalize the export and return the result.
getFileExtension()  : string
Get the file extension for this export format.
getMimeType()  : string
Get the MIME type for this export format.
init()  : void
Initialize the writer for chunked export.
writeChunk()  : void
Write a chunk of responses.

Methods

export()

Export survey responses to the specified format.

public export(array<string|int, mixed> $responses, array<string|int, mixed> $surveyQuestions, array<string|int, mixed> $metadata) : array<string|int, mixed>

Can generate content in-memory or write to a file depending on outputMode in metadata.

Parameters
$responses : array<string|int, mixed>

The survey responses data

$surveyQuestions : array<string|int, mixed>

The survey questions field map

$metadata : array<string|int, mixed>

Additional metadata including:

  • surveyId: int Survey ID
  • language: string Language code
  • outputMode: string 'memory' (default) or 'file'
Return values
array<string|int, mixed>

Export result with the following keys:

  • content: string|null The generated export content (if outputMode is 'memory')
  • filePath: string|null Path to the export file (if outputMode is 'file')
  • filename: string Suggested filename for the export
  • mimeType: string MIME type of the content
  • extension: string File extension
  • size: int Size of the content in bytes
  • responseCount: int Number of responses exported

finalize()

Finalize the export and return the result.

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

Export result with content/filePath and metadata

getFileExtension()

Get the file extension for this export format.

public getFileExtension() : string
Return values
string

File extension (e.g., 'csv', 'xlsx', 'pdf')

getMimeType()

Get the MIME type for this export format.

public getMimeType() : string
Return values
string

MIME type (e.g., 'text/csv', 'application/pdf')

init()

Initialize the writer for chunked export.

public init(array<string|int, mixed> $surveyQuestions, array<string|int, mixed> $metadata) : void
Parameters
$surveyQuestions : array<string|int, mixed>

The survey questions field map (for headers)

$metadata : array<string|int, mixed>

Additional metadata (surveyId, language, etc.)

writeChunk()

Write a chunk of responses.

public writeChunk(array<string|int, mixed> $responses, array<string|int, mixed> $surveyQuestions) : void
Parameters
$responses : array<string|int, mixed>

Chunk of survey responses data

$surveyQuestions : array<string|int, mixed>

The survey questions field map


        
On this page

Search results