Reader
extends AbstractCsv
in package
implements
TabularDataReader, JsonSerializable
A class to parse and read records from a CSV document.
Tags
Table of Contents
Interfaces
- TabularDataReader
- Represents a Tabular data.
- JsonSerializable
Constants
- STREAM_FILTER_MODE = \STREAM_FILTER_READ
Properties
- $delimiter : string
- $document : SplFileObject|Stream
- $enclosure : string
- $escape : string
- $formatters : array<string|int, callable(array<string|int, mixed>): array<string|int, mixed>>
- $header : array<string|int, string>
- $header_offset : int|null
- $input_bom : Bom|null
- $is_empty_records_included : bool
- $is_input_bom_included : bool
- $nb_records : int
- $output_bom : Bom|null
- $stream_filters : array<string, bool>
Methods
- __clone() : mixed
- __toString() : string
- DEPRECATION WARNING! This method will be removed in the next major point release.
- addFormatter() : static
- Adds a record formatter.
- addStreamFilter() : static
- DEPRECATION WARNING! This method will be removed in the next major point release.
- appendStreamFilterOnRead() : static
- Append a stream filter.
- appendStreamFilterOnWrite() : static
- Append a stream filter.
- chunk() : Generator
- Returns the CSV document as a Generator of string chunk.
- chunkBy() : iterable<string|int, TabularDataReader>
- count() : int
- Returns the number of records contained in the tabular data structure excluding the header record.
- createFromFileObject() : static
- DEPRECATION WARNING! This method will be removed in the next major point release.
- createFromPath() : static
- DEPRECATION WARNING! This method will be removed in the next major point release.
- createFromStream() : static
- DEPRECATION WARNING! This method will be removed in the next major point release.
- createFromString() : static
- DEPRECATION WARNING! This method will be removed in the next major point release.
- download() : int
- Outputs all data on the CSV file.
- each() : bool
- exists() : bool
- fetchColumn() : Iterator<int, mixed>
- Returns a single column from the next record of the tabular data.
- fetchColumnByName() : Iterator
- DEPRECATION WARNING! This method will be removed in the next major point release.
- fetchColumnByOffset() : Iterator
- DEPRECATION WARNING! This method will be removed in the next major point release.
- fetchOne() : array<string|int, mixed>
- DEPRECATION WARNING! This method will be removed in the next major point release.
- fetchPairs() : Iterator
- Returns the next key-value pairs from the tabular data (first column is the key, second column is the value).
- filter() : TabularDataReader
- first() : array<string|int, mixed>
- firstAsObject() : object|null
- from() : static
- Returns a new instance from a file path.
- fromString() : static
- Returns a new instance from a string.
- getContent() : string
- Retrieves the CSV content.
- getDelimiter() : string
- Returns the current field delimiter.
- getEnclosure() : string
- Returns the current field enclosure.
- getEscape() : string
- Returns the current field escape character.
- getHeader() : array<string|int, string>
- Returns the header associated with the tabular data.
- getHeaderOffset() : int|null
- Returns the header offset.
- getInputBOM() : string
- Returns the BOM sequence of the given CSV.
- getIterator() : Iterator<string|int, TValue>
- Returns the tabular data rows as an iterator object containing flat array.
- getObjects() : Iterator
- DEPRECATION WARNING! This method will be removed in the next major point release.
- getOutputBOM() : string
- Returns the BOM sequence in use on Output methods.
- getPathname() : string
- Returns the pathname of the underlying document.
- getRecords() : Iterator<string|int, TValue>
- Returns the tabular data records as an iterator object.
- getRecordsAsObject() : iterator<string|int, T>
- getStreamFilterMode() : int
- DEPRECATION WARNING! This method will be removed in the next major point release.
- hasStreamFilter() : bool
- Tells whether the specified stream filter is attached to the current stream.
- includeEmptyRecords() : static
- Disables skipping empty records.
- includeInputBOM() : static
- Disables skipping Input BOM.
- isEmptyRecordsIncluded() : bool
- Tells whether empty records are skipped by the instance.
- isInputBOMIncluded() : bool
- Tells whether the BOM can be stripped if presents.
- jsonSerialize() : array<string|int, mixed>
- last() : array<string|int, mixed>
- lastAsObject() : object|null
- map() : Iterator<string|int, TMap>
- Run a map over each container members.
- mapHeader() : TabularDataReader
- matching() : iterable<int, TabularDataReader>
- EXPERIMENTAL WARNING! This method implementation will change in the next major point release.
- matchingFirst() : TabularDataReader|null
- EXPERIMENTAL WARNING! This method implementation will change in the next major point release.
- matchingFirstOrFail() : TabularDataReader
- EXPERIMENTAL WARNING! This method implementation will change in the next major point release.
- nth() : array<string|int, mixed>
- nthAsObject() : object|null
- output() : int
- DEPRECATION WARNING! This method will be removed in the next major point release.
- prependStreamFilterOnRead() : static
- Prepend a stream filter.
- prependStreamFilterOnWrite() : static
- Prepend a stream filter.
- reduce() : TInitial|null
- select() : TabularDataReader
- selectAllExcept() : TabularDataReader
- setDelimiter() : static
- Sets the field delimiter.
- setEnclosure() : static
- Sets the field enclosure.
- setEscape() : static
- Sets the field escape character.
- setHeaderOffset() : static
- Selects the record to be used as the CSV header.
- setOutputBOM() : static
- Sets the BOM sequence to prepend the CSV on output.
- skipEmptyRecords() : static
- Enables skipping empty records.
- skipInputBOM() : static
- Enables BOM Stripping.
- slice() : TabularDataReader
- sorted() : TabularDataReader
- supportsStreamFilter() : bool
- DEPRECATION WARNING! This method will be removed in the next major point release.
- supportsStreamFilterOnRead() : bool
- Tells whether the stream filter read capabilities can be used.
- supportsStreamFilterOnWrite() : bool
- Tells whether the stream filter write capabilities can be used.
- toString() : string
- Retrieves the CSV content.
- value() : mixed
- __construct() : mixed
- combineHeader() : Iterator
- computeHeader() : array<string|int, int|string>
- Returns the header to be used for iteration.
- getDocument() : SplFileObject|Stream
- getLastRecord() : array<string|int, mixed>
- prepareHeader() : array<string|int, int|string>
- prepareRecords() : Iterator
- removeBOM() : array<string|int, string>
- Strips the BOM sequence from a record.
- resetProperties() : void
- Reset dynamic object properties to improve performance.
- seekRow() : array<string|int, mixed>
- sendHeaders() : void
- DEPRECATION WARNING! This method will be removed in the next major point release.
- setHeader() : array<string|int, string>
- Determines the CSV record header.
- stripBOM() : Iterator
- Strips the BOM sequence from the returned records if necessary.
Constants
STREAM_FILTER_MODE
protected
mixed
STREAM_FILTER_MODE
= \STREAM_FILTER_READ
Properties
$delimiter
protected
string
$delimiter
= ','
$document read-only
protected
SplFileObject|Stream
$document
$enclosure
protected
string
$enclosure
= '"'
$escape
protected
string
$escape
= '\\'
$formatters
protected
array<string|int, callable(array<string|int, mixed>): array<string|int, mixed>>
$formatters
= []
collection of Closure to format the record before reading.
$header
protected
array<string|int, string>
$header
= []
header record.
$header_offset
protected
int|null
$header_offset
= null
$input_bom
protected
Bom|null
$input_bom
= null
$is_empty_records_included
protected
bool
$is_empty_records_included
= false
$is_input_bom_included
protected
bool
$is_input_bom_included
= false
$nb_records
protected
int
$nb_records
= -1
$output_bom
protected
Bom|null
$output_bom
= null
$stream_filters
protected
array<string, bool>
$stream_filters
= []
collection of stream filters.
Methods
__clone()
public
__clone() : mixed
Tags
__toString()
DEPRECATION WARNING! This method will be removed in the next major point release.
public
__toString() : string
since version 9.1.0
use League\Csv\AbstractCsv::toString() instead
Tags
Return values
stringaddFormatter()
Adds a record formatter.
public
addFormatter(callable(array<string|int, mixed>): array<string|int, mixed> $formatter) : static
Parameters
- $formatter : callable(array<string|int, mixed>): array<string|int, mixed>
Return values
staticaddStreamFilter()
DEPRECATION WARNING! This method will be removed in the next major point release.
public
addStreamFilter(string $filtername[, array<string|int, mixed>|null $params = null ]) : static
since version 9.22.0
use League\Csv\AbstractCsv::appendStreamFilterOnRead() or League\Csv\AbstractCsv::prependStreamFilterOnRead() instead
Parameters
- $filtername : string
- $params : array<string|int, mixed>|null = null
Tags
Return values
staticappendStreamFilterOnRead()
Append a stream filter.
public
appendStreamFilterOnRead(string $filtername[, mixed $params = null ]) : static
Parameters
- $filtername : string
- $params : mixed = null
Tags
Return values
staticappendStreamFilterOnWrite()
Append a stream filter.
public
appendStreamFilterOnWrite(string $filtername[, mixed $params = null ]) : static
Parameters
- $filtername : string
- $params : mixed = null
Tags
Return values
staticchunk()
Returns the CSV document as a Generator of string chunk.
public
chunk(int $length) : Generator
Parameters
- $length : int
Tags
Return values
GeneratorchunkBy()
public
chunkBy(positive-int $recordsCount) : iterable<string|int, TabularDataReader>
Parameters
- $recordsCount : positive-int
Tags
Return values
iterable<string|int, TabularDataReader>count()
Returns the number of records contained in the tabular data structure excluding the header record.
public
count() : int
Tags
Return values
intcreateFromFileObject()
DEPRECATION WARNING! This method will be removed in the next major point release.
public
static createFromFileObject(SplFileObject $file) : static
since version 9.27.0
Returns a new instance from a SplFileObject.
use League\Csv\AbstractCsv::from() instead
Parameters
- $file : SplFileObject
Tags
Return values
staticcreateFromPath()
DEPRECATION WARNING! This method will be removed in the next major point release.
public
static createFromPath(string $path[, non-empty-string $open_mode = 'r' ][, resource|null $context = null ]) : static
since version 9.27.0
Returns a new instance from a file path.
use League\Csv\AbstractCsv::from() instead
Parameters
- $path : string
- $open_mode : non-empty-string = 'r'
- $context : resource|null = null
-
the resource context
Tags
Return values
staticcreateFromStream()
DEPRECATION WARNING! This method will be removed in the next major point release.
public
static createFromStream(resource $stream) : static
since version 9.27.0
Returns a new instance from a PHP resource stream.
use League\Csv\AbstractCsv::from() instead
Parameters
- $stream : resource
Tags
Return values
staticcreateFromString()
DEPRECATION WARNING! This method will be removed in the next major point release.
public
static createFromString([Stringable|string $content = '' ]) : static
since version 9.27.0
Returns a new instance from a string.
use League\Csv\AbstractCsv::fromString() instead
Parameters
- $content : Stringable|string = ''
Tags
Return values
staticdownload()
Outputs all data on the CSV file.
public
download([string|null $filename = null ]) : int
Returns the number of characters read from the handle and passed through to the output.
Parameters
- $filename : string|null = null
Tags
Return values
inteach()
public
each(
Warning: Array to string conversion in C:\xampp\htdocs\vendor\phpdocumentor\phpdocumentor\src\phpDocumentor\Transformer\Writer\Twig\LinkRenderer\CallableAdapter.php on line 64
Warning: Array to string conversion in C:\xampp\htdocs\vendor\phpdocumentor\phpdocumentor\src\phpDocumentor\Transformer\Writer\Twig\LinkRenderer\CallableAdapter.php on line 78
callable(array<string|int, mixed>, Array=): Array $callback) : bool
Parameters
- $callback : Warning: Array to string conversion in C:\xampp\htdocs\vendor\phpdocumentor\phpdocumentor\src\phpDocumentor\Transformer\Writer\Twig\LinkRenderer\CallableAdapter.php on line 64 Warning: Array to string conversion in C:\xampp\htdocs\vendor\phpdocumentor\phpdocumentor\src\phpDocumentor\Transformer\Writer\Twig\LinkRenderer\CallableAdapter.php on line 78 callable(array<string|int, mixed>, Array=): Array
Return values
boolexists()
public
exists(
Warning: Array to string conversion in C:\xampp\htdocs\vendor\phpdocumentor\phpdocumentor\src\phpDocumentor\Transformer\Writer\Twig\LinkRenderer\CallableAdapter.php on line 64
callable(array<string|int, mixed>, Array=): bool $callback) : bool
Parameters
- $callback : Warning: Array to string conversion in C:\xampp\htdocs\vendor\phpdocumentor\phpdocumentor\src\phpDocumentor\Transformer\Writer\Twig\LinkRenderer\CallableAdapter.php on line 64 callable(array<string|int, mixed>, Array=): bool
Return values
boolfetchColumn()
Returns a single column from the next record of the tabular data.
public
fetchColumn([string|int $index = 0 ]) : Iterator<int, mixed>
By default, if no value is supplied the first column is fetched
Parameters
- $index : string|int = 0
-
CSV column index
Return values
Iterator<int, mixed>fetchColumnByName()
DEPRECATION WARNING! This method will be removed in the next major point release.
public
fetchColumnByName(string $name) : Iterator
since version 9.23.0
use League\Csv\Resultset::fetchColumn() instead
Parameters
- $name : string
Tags
Return values
IteratorfetchColumnByOffset()
DEPRECATION WARNING! This method will be removed in the next major point release.
public
fetchColumnByOffset([int $offset = 0 ]) : Iterator
since version 9.23.0
use League\Csv\Resultset::fetchColumn() instead
Parameters
- $offset : int = 0
Tags
Return values
IteratorfetchOne()
DEPRECATION WARNING! This method will be removed in the next major point release.
public
fetchOne([int $nth_record = 0 ]) : array<string|int, mixed>
since version 9.9.0
use League\Csv\Reader::nth() instead
Parameters
- $nth_record : int = 0
-
the tabular data record offset
Tags
Return values
array<string|int, mixed>fetchPairs()
Returns the next key-value pairs from the tabular data (first column is the key, second column is the value).
public
fetchPairs([string|int $offset_index = 0 ][, string|int $value_index = 1 ]) : Iterator
By default, if no column index is provided:
- the first column is used to provide the keys
- the second column is used to provide the value
Parameters
- $offset_index : string|int = 0
-
The column index to serve as offset
- $value_index : string|int = 1
-
The column index to serve as value
Return values
Iteratorfilter()
public
filter(
Warning: Array to string conversion in C:\xampp\htdocs\vendor\phpdocumentor\phpdocumentor\src\phpDocumentor\Transformer\Writer\Twig\LinkRenderer\CallableAdapter.php on line 64
Predicate|callable(array<string|int, mixed>, Array): bool $predicate) : TabularDataReader
Parameters
- $predicate : Warning: Array to string conversion in C:\xampp\htdocs\vendor\phpdocumentor\phpdocumentor\src\phpDocumentor\Transformer\Writer\Twig\LinkRenderer\CallableAdapter.php on line 64 Predicate|callable(array<string|int, mixed>, Array): bool
Tags
Return values
TabularDataReaderfirst()
public
first() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>firstAsObject()
public
firstAsObject(class-string $className[, array<string|int, mixed> $header = [] ]) : object|null
Parameters
- $className : class-string
- $header : array<string|int, mixed> = []
Tags
Return values
object|nullfrom()
Returns a new instance from a file path.
public
static from(mixed $filename[, string $mode = 'r' ][, mixed $context = null ]) : static
Parameters
- $filename : mixed
-
an SPL file object, a resource stream or a file path
- $mode : string = 'r'
-
the file path open mode used with a file path or a SplFileInfo object
- $context : mixed = null
-
the resource context used with a file pathor a SplFileInfo object
Return values
staticfromString()
Returns a new instance from a string.
public
static fromString([Stringable|string $content = '' ]) : static
Parameters
- $content : Stringable|string = ''
Return values
staticgetContent()
Retrieves the CSV content.
public
getContent() : string
since version 9.7.0
use League\Csv\AbstractCsv::toString() instead
DEPRECATION WARNING! This method will be removed in the next major point release
Tags
Return values
stringgetDelimiter()
Returns the current field delimiter.
public
getDelimiter() : string
Return values
stringgetEnclosure()
Returns the current field enclosure.
public
getEnclosure() : string
Return values
stringgetEscape()
Returns the current field escape character.
public
getEscape() : string
Return values
stringgetHeader()
Returns the header associated with the tabular data.
public
getHeader() : array<string|int, string>
Tags
Return values
array<string|int, string>getHeaderOffset()
Returns the header offset.
public
getHeaderOffset() : int|null
Return values
int|nullgetInputBOM()
Returns the BOM sequence of the given CSV.
public
getInputBOM() : string
Return values
stringgetIterator()
Returns the tabular data rows as an iterator object containing flat array.
public
getIterator() : Iterator<string|int, TValue>
Tags
Return values
Iterator<string|int, TValue>getObjects()
DEPRECATION WARNING! This method will be removed in the next major point release.
public
getObjects(class-string $className[, array<string|int, string> $header = [] ]) : Iterator
Since version 9.15.0
use League\Csv\Reader::getRecordsAsObject() instead
Parameters
- $className : class-string
- $header : array<string|int, string> = []
Tags
Return values
IteratorgetOutputBOM()
Returns the BOM sequence in use on Output methods.
public
getOutputBOM() : string
Return values
stringgetPathname()
Returns the pathname of the underlying document.
public
getPathname() : string
Return values
stringgetRecords()
Returns the tabular data records as an iterator object.
public
getRecords([array<string|int, string> $header = [] ]) : Iterator<string|int, TValue>
Parameters
- $header : array<string|int, string> = []
Tags
Return values
Iterator<string|int, TValue>getRecordsAsObject()
public
getRecordsAsObject(T> $className[, array<string|int, string> $header = [] ]) : iterator<string|int, T>
Parameters
- $className : T>
- $header : array<string|int, string> = []
Tags
Return values
iterator<string|int, T>getStreamFilterMode()
DEPRECATION WARNING! This method will be removed in the next major point release.
public
getStreamFilterMode() : int
since version 9.7.0
use League\Csv\AbstractCsv::supportsStreamFilterOnRead() or League\Csv\AbstractCsv::supportsStreamFilterOnWrite() instead
Tags
Return values
inthasStreamFilter()
Tells whether the specified stream filter is attached to the current stream.
public
hasStreamFilter(string $filtername) : bool
Parameters
- $filtername : string
Return values
boolincludeEmptyRecords()
Disables skipping empty records.
public
includeEmptyRecords() : static
Return values
staticincludeInputBOM()
Disables skipping Input BOM.
public
includeInputBOM() : static
Return values
staticisEmptyRecordsIncluded()
Tells whether empty records are skipped by the instance.
public
isEmptyRecordsIncluded() : bool
Return values
boolisInputBOMIncluded()
Tells whether the BOM can be stripped if presents.
public
isInputBOMIncluded() : bool
Return values
booljsonSerialize()
public
jsonSerialize() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>last()
public
last() : array<string|int, mixed>
Return values
array<string|int, mixed>lastAsObject()
public
lastAsObject(class-string $className[, array<string|int, mixed> $header = [] ]) : object|null
Parameters
- $className : class-string
- $header : array<string|int, mixed> = []
Tags
Return values
object|nullmap()
Run a map over each container members.
public
map(callable(array<string|int, mixed>, int): TMap $callback) : Iterator<string|int, TMap>
Parameters
- $callback : callable(array<string|int, mixed>, int): TMap
Tags
Return values
Iterator<string|int, TMap>mapHeader()
public
mapHeader(array<string|int, string> $headers) : TabularDataReader
Parameters
- $headers : array<string|int, string>
Return values
TabularDataReadermatching()
EXPERIMENTAL WARNING! This method implementation will change in the next major point release.
public
matching(string $expression) : iterable<int, TabularDataReader>
Extract all found fragment identifiers for the specifield tabular data
Parameters
- $expression : string
Tags
Return values
iterable<int, TabularDataReader>matchingFirst()
EXPERIMENTAL WARNING! This method implementation will change in the next major point release.
public
matchingFirst(string $expression) : TabularDataReader|null
Extract the first found fragment identifier of the tabular data or returns null
Parameters
- $expression : string
Tags
Return values
TabularDataReader|nullmatchingFirstOrFail()
EXPERIMENTAL WARNING! This method implementation will change in the next major point release.
public
matchingFirstOrFail(string $expression) : TabularDataReader
Extract the first found fragment identifier of the tabular data or fail
Parameters
- $expression : string
Tags
Return values
TabularDataReadernth()
public
nth(int $nth) : array<string|int, mixed>
Parameters
- $nth : int
Tags
Return values
array<string|int, mixed>nthAsObject()
public
nthAsObject(int $nth, class-string $className[, array<string|int, mixed> $header = [] ]) : object|null
Parameters
- $nth : int
- $className : class-string
- $header : array<string|int, mixed> = []
Tags
Return values
object|nulloutput()
DEPRECATION WARNING! This method will be removed in the next major point release.
public
output([string|null $filename = null ]) : int
since version 9.18.0
use League\Csv\AbstractCsv::download() instead
Parameters
- $filename : string|null = null
Tags
Return values
intprependStreamFilterOnRead()
Prepend a stream filter.
public
prependStreamFilterOnRead(string $filtername[, mixed $params = null ]) : static
Parameters
- $filtername : string
- $params : mixed = null
Tags
Return values
staticprependStreamFilterOnWrite()
Prepend a stream filter.
public
prependStreamFilterOnWrite(string $filtername[, mixed $params = null ]) : static
Parameters
- $filtername : string
- $params : mixed = null
Tags
Return values
staticreduce()
public
reduce(
Warning: Array to string conversion in C:\xampp\htdocs\vendor\phpdocumentor\phpdocumentor\src\phpDocumentor\Transformer\Writer\Twig\LinkRenderer\CallableAdapter.php on line 64
Warning: Array to string conversion in C:\xampp\htdocs\vendor\phpdocumentor\phpdocumentor\src\phpDocumentor\Transformer\Writer\Twig\LinkRenderer\CallableAdapter.php on line 64
callable(Array, array<string|int, mixed>, Array=): TInitial $callback[, TInitial|null $initial = null ]) : TInitial|null
Parameters
- $callback : Warning: Array to string conversion in C:\xampp\htdocs\vendor\phpdocumentor\phpdocumentor\src\phpDocumentor\Transformer\Writer\Twig\LinkRenderer\CallableAdapter.php on line 64 Warning: Array to string conversion in C:\xampp\htdocs\vendor\phpdocumentor\phpdocumentor\src\phpDocumentor\Transformer\Writer\Twig\LinkRenderer\CallableAdapter.php on line 64 callable(Array, array<string|int, mixed>, Array=): TInitial
- $initial : TInitial|null = null
Tags
Return values
TInitial|nullselect()
public
select(string|int ...$columns) : TabularDataReader
Parameters
- $columns : string|int
Return values
TabularDataReaderselectAllExcept()
public
selectAllExcept(string|int ...$columns) : TabularDataReader
Parameters
- $columns : string|int
Return values
TabularDataReadersetDelimiter()
Sets the field delimiter.
public
setDelimiter(string $delimiter) : static
Parameters
- $delimiter : string
Tags
Return values
staticsetEnclosure()
Sets the field enclosure.
public
setEnclosure(string $enclosure) : static
Parameters
- $enclosure : string
Tags
Return values
staticsetEscape()
Sets the field escape character.
public
setEscape(string $escape) : static
Parameters
- $escape : string
Tags
Return values
staticsetHeaderOffset()
Selects the record to be used as the CSV header.
public
setHeaderOffset(int|null $offset) : static
Because the header is represented as an array, to be valid a header MUST contain only unique string value.
Parameters
- $offset : int|null
-
the header record offset
Tags
Return values
staticsetOutputBOM()
Sets the BOM sequence to prepend the CSV on output.
public
setOutputBOM(Bom|string|null $str) : static
Parameters
- $str : Bom|string|null
Tags
Return values
staticskipEmptyRecords()
Enables skipping empty records.
public
skipEmptyRecords() : static
Return values
staticskipInputBOM()
Enables BOM Stripping.
public
skipInputBOM() : static
Return values
staticslice()
public
slice(int<0, max> $offset[, int<-1, max> $length = -1 ]) : TabularDataReader
Parameters
- $offset : int<0, max>
- $length : int<-1, max> = -1
Tags
Return values
TabularDataReadersorted()
public
sorted(callable(mixed, mixed): int $orderBy) : TabularDataReader
Parameters
- $orderBy : callable(mixed, mixed): int
Tags
Return values
TabularDataReadersupportsStreamFilter()
DEPRECATION WARNING! This method will be removed in the next major point release.
public
supportsStreamFilter() : bool
since version 9.7.0
use League\Csv\AbstractCsv::supportsStreamFilterOnRead() or League\Csv\AbstractCsv::supportsStreamFilterOnWrite() instead
Tags
Return values
boolsupportsStreamFilterOnRead()
Tells whether the stream filter read capabilities can be used.
public
supportsStreamFilterOnRead() : bool
Return values
boolsupportsStreamFilterOnWrite()
Tells whether the stream filter write capabilities can be used.
public
supportsStreamFilterOnWrite() : bool
Return values
booltoString()
Retrieves the CSV content.
public
toString() : string
Tags
Return values
stringvalue()
public
value([int|string $column = 0 ]) : mixed
Parameters
- $column : int|string = 0
__construct()
protected
__construct(SplFileObject|Stream $document) : mixed
Parameters
- $document : SplFileObject|Stream
Tags
combineHeader()
protected
combineHeader(Iterator $iterator, array<string|int, mixed> $header) : Iterator
Parameters
- $iterator : Iterator
- $header : array<string|int, mixed>
Return values
IteratorcomputeHeader()
Returns the header to be used for iteration.
protected
computeHeader(array<string|int, int|string> $header) : array<string|int, int|string>
Parameters
- $header : array<string|int, int|string>
Tags
Return values
array<string|int, int|string>getDocument()
protected
getDocument() : SplFileObject|Stream
Tags
Return values
SplFileObject|StreamgetLastRecord()
protected
getLastRecord(array<string|int, mixed> $header) : array<string|int, mixed>
Parameters
- $header : array<string|int, mixed>
Return values
array<string|int, mixed>prepareHeader()
protected
prepareHeader([array<string|int, string> $header = [] ]) : array<string|int, int|string>
Parameters
- $header : array<string|int, string> = []
Tags
Return values
array<string|int, int|string>prepareRecords()
protected
prepareRecords() : Iterator
Tags
Return values
IteratorremoveBOM()
Strips the BOM sequence from a record.
protected
removeBOM(array<string|int, string> $record, int $bom_length, string $enclosure) : array<string|int, string>
Parameters
- $record : array<string|int, string>
- $bom_length : int
- $enclosure : string
Return values
array<string|int, string>resetProperties()
Reset dynamic object properties to improve performance.
protected
resetProperties() : void
seekRow()
protected
seekRow(int $offset) : array<string|int, mixed>
Parameters
- $offset : int
Tags
Return values
array<string|int, mixed>sendHeaders()
DEPRECATION WARNING! This method will be removed in the next major point release.
protected
sendHeaders(string $filename) : void
since version 9.17.0
the method no longer affect the outcome of the class, use League\Csv\HttpHeaders::forFileDownload instead
Parameters
- $filename : string
Tags
setHeader()
Determines the CSV record header.
protected
setHeader(int $offset) : array<string|int, string>
Parameters
- $offset : int
Tags
Return values
array<string|int, string>stripBOM()
Strips the BOM sequence from the returned records if necessary.
protected
stripBOM(Iterator $iterator, Bom|null $bom) : Iterator
Parameters
- $iterator : Iterator
- $bom : Bom|null