Documentation

Output

A trait to output CSV

Tags
since
6.3.0

Table of Contents

$input_bom  : string
The Input file BOM character
$input_encoding  : string
Charset Encoding for the CSV
$output_bom  : string
The Output file BOM character
__toString()  : string
Retrieves the CSV content
getEncodingFrom()  : string
Gets the source CSV encoding charset
getInputBOM()  : string
Returns the BOM sequence of the given CSV
getInputEncoding()  : string
Gets the source CSV encoding charset
getIterator()  : mixed
getOutputBOM()  : string
Returns the BOM sequence in use on Output methods
jsonSerialize()  : mixed
output()  : int
Outputs all data on the CSV file
setEncodingFrom()  : static
Sets the CSV encoding charset
setInputEncoding()  : static
Sets the CSV encoding charset
setOutputBOM()  : static
Sets the BOM sequence to prepend the CSV on output
toHTML()  : string
Returns a HTML table representation of the CSV Table
toXML()  : DomDocument
Transforms a CSV into a XML
convertToUtf8()  : Iterator
Convert Csv file into UTF-8
fpassthru()  : int
Outputs all data from the CSV
getQueryIterator()  : Iterator
Returns the CSV Iterator

Properties

$input_bom

The Input file BOM character

protected string $input_bom

$input_encoding

Charset Encoding for the CSV

protected string $input_encoding = 'UTF-8'

$output_bom

The Output file BOM character

protected string $output_bom = ''

Methods

__toString()

Retrieves the CSV content

public __toString() : string
Return values
string —

getEncodingFrom()

Gets the source CSV encoding charset

public getEncodingFrom() : string

DEPRECATION WARNING! This method will be removed in the next major point release

Tags
deprecated

deprecated since version 8.1

Return values
string —

getInputBOM()

Returns the BOM sequence of the given CSV

public getInputBOM() : string
Return values
string —

getInputEncoding()

Gets the source CSV encoding charset

public getInputEncoding() : string
Return values
string —

getIterator()

public abstract getIterator() : mixed
Tags
inheritdoc
Return values
mixed —

getOutputBOM()

Returns the BOM sequence in use on Output methods

public getOutputBOM() : string
Return values
string —

jsonSerialize()

public jsonSerialize() : mixed
Tags
inheritdoc
Return values
mixed —

output()

Outputs all data on the CSV file

public output([string $filename = null ]) : int
Parameters
$filename : string = null

CSV downloaded name if present adds extra headers

Return values
int —

Returns the number of characters read from the handle and passed through to the output.

setEncodingFrom()

Sets the CSV encoding charset

public setEncodingFrom(string $str) : static

DEPRECATION WARNING! This method will be removed in the next major point release

Parameters
$str : string
Tags
deprecated

deprecated since version 8.1

Return values
static —

setInputEncoding()

Sets the CSV encoding charset

public setInputEncoding(string $str) : static
Parameters
$str : string
Return values
static —

setOutputBOM()

Sets the BOM sequence to prepend the CSV on output

public setOutputBOM(string $str) : static
Parameters
$str : string

The BOM sequence

Return values
static —

toHTML()

Returns a HTML table representation of the CSV Table

public toHTML([string $class_attr = 'table-csv-data' ]) : string
Parameters
$class_attr : string = 'table-csv-data'

optional classname

Return values
string —

toXML()

Transforms a CSV into a XML

public toXML([string $root_name = 'csv' ][, string $row_name = 'row' ][, string $cell_name = 'cell' ]) : DomDocument
Parameters
$root_name : string = 'csv'

XML root node name

$row_name : string = 'row'

XML row node name

$cell_name : string = 'cell'

XML cell node name

Return values
DomDocument —

convertToUtf8()

Convert Csv file into UTF-8

protected convertToUtf8(Iterator $iterator) : Iterator
Parameters
$iterator : Iterator
Return values
Iterator —

fpassthru()

Outputs all data from the CSV

protected fpassthru() : int
Return values
int —

Returns the number of characters read from the handle and passed through to the output.

getQueryIterator()

Returns the CSV Iterator

protected abstract getQueryIterator() : Iterator
Return values
Iterator —

Search results