Properties

$stream_filter_mode

$stream_filter_mode : integer

The stream filter mode (read or write).

Type

integer

$stream_filters

$stream_filters : array<mixed,boolean>

collection of stream filters.

Type

array<mixed,boolean>

$input_bom

$input_bom : string|null

The CSV document BOM sequence.

Type

string|null

$output_bom

$output_bom : string

The Output file BOM character.

Type

string

$delimiter

$delimiter : string

the field delimiter (one character only).

Type

string

$enclosure

$enclosure : string

the field enclosure character (one character only).

Type

string

$escape

$escape : string

the field escape character (one character only).

Type

string

$document

$document : \SplFileObject|\League\Csv\Stream

The CSV document.

Type

\SplFileObject|\League\Csv\Stream

$is_input_bom_included

$is_input_bom_included : boolean

Tells whether the Input BOM must be included or skipped.

Type

boolean

Methods

__destruct()

__destruct() 

{@inheritdoc}

__clone()

__clone() 

{@inheritdoc}

createFromFileObject()

createFromFileObject(\SplFileObject  $file) : static

Return a new instance from a SplFileObject.

Parameters

\SplFileObject $file

Returns

static

createFromStream()

createFromStream(resource  $stream) : static

Return a new instance from a PHP resource stream.

Parameters

resource $stream

Returns

static

createFromString()

createFromString(\League\Csv\string  $content = '') : static

Return a new instance from a string.

Parameters

\League\Csv\string $content

Returns

static

createFromPath()

createFromPath(\League\Csv\string  $path, \League\Csv\string  $open_mode = 'r+', resource|null  $context = null) : static

Return a new instance from a file path.

Parameters

\League\Csv\string $path
\League\Csv\string $open_mode
resource|null $context

the resource context

Returns

static

getDelimiter()

getDelimiter() 

Returns the current field delimiter.

getEnclosure()

getEnclosure() 

Returns the current field enclosure.

getPathname()

getPathname() 

Returns the pathname of the underlying document.

getEscape()

getEscape() 

Returns the current field escape character.

getOutputBOM()

getOutputBOM() 

Returns the BOM sequence in use on Output methods.

getInputBOM()

getInputBOM() 

Returns the BOM sequence of the given CSV.

getStreamFilterMode()

getStreamFilterMode() 

Returns the stream filter mode.

supportsStreamFilter()

supportsStreamFilter() 

Tells whether the stream filter capabilities can be used.

hasStreamFilter()

hasStreamFilter(\League\Csv\string  $filtername) 

Tell whether the specify stream filter is attach to the current stream.

Parameters

\League\Csv\string $filtername

isInputBOMIncluded()

isInputBOMIncluded() 

Tells whether the BOM can be stripped if presents.

chunk()

chunk(integer  $length) 

Retuns the CSV document as a Generator of string chunk.

Parameters

integer $length

number of bytes read

Throws

\League\Csv\Exception

if the number of bytes is lesser than 1

__toString()

__toString() 

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

getContent()

getContent() 

Retrieves the CSV content.

output()

output(\League\Csv\string  $filename = null) : integer

Outputs all data on the CSV file.

Parameters

\League\Csv\string $filename

Returns

integer —

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

setDelimiter()

setDelimiter(\League\Csv\string  $delimiter) : static

Sets the field delimiter.

Parameters

\League\Csv\string $delimiter

Throws

\League\Csv\Exception

If the Csv control character is not one character only.

Returns

static

setEnclosure()

setEnclosure(\League\Csv\string  $enclosure) : static

Sets the field enclosure.

Parameters

\League\Csv\string $enclosure

Throws

\League\Csv\Exception

If the Csv control character is not one character only.

Returns

static

setEscape()

setEscape(\League\Csv\string  $escape) : static

Sets the field escape character.

Parameters

\League\Csv\string $escape

Throws

\League\Csv\Exception

If the Csv control character is not one character only.

Returns

static

skipInputBOM()

skipInputBOM() : static

Enables BOM Stripping.

Returns

static

includeInputBOM()

includeInputBOM() : static

Disables skipping Input BOM.

Returns

static

setOutputBOM()

setOutputBOM(\League\Csv\string  $str) : static

Sets the BOM sequence to prepend the CSV on output.

Parameters

\League\Csv\string $str

Returns

static

addStreamFilter()

addStreamFilter(\League\Csv\string  $filtername, null|mixed  $params = null) : static

append a stream filter.

Parameters

\League\Csv\string $filtername
null|mixed $params

Throws

\League\Csv\Exception

If the stream filter API can not be used

Returns

static

__construct()

__construct(\SplFileObject|\League\Csv\Stream  $document) 

New instance.

Parameters

\SplFileObject|\League\Csv\Stream $document

The CSV Object instance

resetProperties()

resetProperties() 

Reset dynamic object properties to improve performance.

sendHeaders()

sendHeaders(\League\Csv\string  $filename) 

Send the CSV headers.

Adapted from Symfony\Component\HttpFoundation\ResponseHeaderBag::makeDisposition

Parameters

\League\Csv\string $filename

Throws

\League\Csv\Exception

if the submitted header is invalid according to RFC 6266