Skip to content

ExportCSV

Mehdi Bounya edited this page Jul 17, 2018 · 3 revisions

The \PHPForms\ExportCSV() class is used to export data to a CSV file.

Content

\PHPForms\ExportCSV() methods

construct

  • Arguments:
    • string $file_path: The CSV file path, if none exists it will be created.
    • array $data = []: Data to be exported.
    • array $map = []: A map for the data. Read more here

setFilePath

  • Arguments:
    • string $file_path: File path

Set CSV file path

addData

  • Arguments:
    • string $name: The field name
    • string $value: Field's value

Add data to be exported, if data exists with the same field name its value will be replaced.

setMap

  • Arguments:
    • array $map: Map to set

Add a map to the exporter, if a map already exists it will be overwritten. More on maps

export

  • Returns: bool

Export the data to the CSV file, return TRUE on success or FALSE otherwise. If a file already exists the data will be appended to it. If no file was found a new one will be created.

Clone this wiki locally