#Changelog
All Notable changes to League\Csv
will be documented in this file
stripBOM
query filtering method to ease removing the BOM sequence when querying the CSV document.- All query filters are now accessible in the
Writer
class for conversion methods.
- Internal code has been updated to take into account bug fix #68479
setFlags
on conversion methods SplFileObject default flags areSplFileObject::READ_AHEAD|SplFileObject::SKIP_EMPTY
insertOne
now takes into account the escape character when modified after the first insert.
setFlags
:SplFileObject::DROP_NEW_LINE
can be remove usingsetFlags
method.
- A new flexible mechanism to format and validate a row before its insertion by adding
Writer::addFormatter
to add a formatter to theWriter
objectWriter::removeFormatter
to remove an already registered formatterWriter::hasFormatter
to detect the presence of a formatterWriter::clearFormatters
to clear all registered formatterWriter::addValidator
to add a validator to theWriter
objectWriter::removeValidator
to remove an already registered validatorWriter::hasValidator
to detect the presence of a validatorWriter::clearValidators
to clear all registered validatorLeague\Csv\Exception\InvalidRowException
exception thrown when row validation failed
- Classes to maintain removed features from the
Writer
classLeague\Csv\Plugin\ColumnConsistencyValidator
to validate column consistency on insertionLeague\Csv\Plugin\ForbiddenNullValuesValidator
to validatenull
value on insertionLeague\Csv\Plugin\SkipNullValuesFormatter
to formatnull
value on insertion
- Nothing
jsonSerialize
,toXML
andtoHTML
output can be modified usingReader
query options methods.AbstractCSV::detectDelimiterList
index keys now represents the occurrence of the found delimiter.getNewline
andsetNewline
are accessible on theReader
class too.- the named constructor
createFromString
now accepts the$newline
sequence as a second argument to specify the last added new line character to better work with interoperability. - Default value on CSV controls setter methods
setDelimiter
,setEnclosure
andsetEscape
are removed - Default
SplFileObject
flags value is nowSplFileObject::READ_CSV|SplFileObject::DROP_NEW_LINE
- All CSV properties are now copied when using
newReader
andnewWriter
methods - BOM addition on output improved by removing if found the existing BOM character
- the
AbstractCSV::output
method now returns the number of bytes send to the output buffer Reader::fetchColumn
will automatically filter out non existing values from the return array
- Setting
ini_set("auto_detect_line_endings", true);
is no longer set in the class constructor. Mac OS X users must explicitly set this ini options in their script. Writer
andReader
default constructor are removed from public API in favor of the named constructors.- All
Writer
methods and constant related to CSV data validation and formatting before insertionWriter::getNullHandlingMode
Writer::setNullHandlingMode
Writer::setColumnsCount
Writer::getColumnsCount
Writer::autodetectColumnsCount
Writer::NULL_AS_EXCEPTION
Writer::NULL_AS_EMPTY
Writer::NULL_AS_SKIP_CELL
AbstractCSV::setOutputBOM
AbstractCSV::getOutputBOM
AbstractCSV::getInputBOM
to manage BOM character with CSV.
Writer::setNewline
,Writer::getNewline
to control the newline sequence character added at the end of each CSV row.
Reader::fetchAssoc
now also accepts an integer as first argument representing a row index.
- Bug Fixed
detectDelimiterList
- Stream Filter API in
League\Csv\AbstractCsv
- named constructors
createFromPath
andcreateFromFileObject
inLeague\Csv\AbstractCsv
to ease CSV object instantiation detectDelimiterList
inLeague\Csv\AbstractCsv
to replace and remove the use ofRuntimeException
indetectDelimiter
setEncodingFrom
andsetDecodingFrom
inLeague\Csv\AbstractCsv
to replacesetEncoding
andgetEncoding
for naming consistencynewWriter
andnewReader
methods inLeague\Csv\AbstractCsv
to replaceWriter::getReader
andReader::getWriter
- Nothing
League\Csv\Reader::each
more strict$callable
MUST returnstrue
League\Csv\AbstractCsv::detectDelimiter
League\Csv\AbstractCsv::setEncoding
andLeague\Csv\AbstractCsv::getEncoding
League\Csv\Reader::setSortBy
League\Csv\Reader::setFilter
League\Csv\Reader::getWriter
League\Csv\Writer::getReader
League\Csv\Reader::fetchCol
League\Csv\Writer::setColumnsCount
,League\Csv\Writer::getColumnsCount
,League\Csv\Writer::autodetectColumnsCount
to enable column consistency in writer modeLeague\Csv\Reader::fetchColumn
replacesLeague\Csv\Reader::fetchCol
for naming consistency
League\Csv\Reader::fetchCol
- Nothing
- Nothing
- Nothing
$open_mode
default tor+
inLeague\Csv\AbstractCsv
constructors
League\Csv\Writer::setNullHandlingMode
andLeague\Csv\Writer::getNullHandlingMode
to handlenull
value
setting ini_set("auto_detect_line_endings", true);
no longer needed for Mac OS
League\Csv\Reader::addSortBy
,League\Csv\Reader::removeSortBy
,League\Csv\Reader::hasSortBy
,League\Csv\Reader::clearSortBy
to improve sortingLeague\Csv\Reader::clearFilter
to align extract filter capabilities to sorting capabilities
League\Csv\Reader::setSortBy
replaced by a better implementation
League\Csv\Reader::setOffset
now default to 0;League\Csv\Reader::setLimit
now default to -1;detectDelimiter
bug fixes
League\Csv\Reader::each
to ease CSV import dataLeague\Csv\Reader::addFilter
,League\Csv\Reader::removeFilter
,League\Csv\Reader::hasFilter
to improve extract filter capabilitiesdetectDelimiter
method toLeague\Csv\AbstractCsv
to sniff CSV delimiter character.
League\Csv\Reader::setFilter
replaced by a better implementation
- Change namespace from
Bakame\Csv
toLeague\Csv
- Nothing
- Nothing
$open_mode
validation is done by PHP internals directly
toXML
method to transcode the CSV into a XML inBakame\Csv\AbstractCsv
toHTML
method bug inBakame\Csv\AbstractCsv
output
method accepts an optional$filename
argumentBakame\Csv\Reader::fetchCol
default to$columnIndex = 0
Bakame\Csv\Reader::fetchOne
default to$offset = 0
- Move from
PSR-0
toPSR-4
to autoload the library
Bakame\Csv\Reader
methods fixedjsonSerialize
bug fixed
getEncoding
andsetEncoding
methods toBakame\Csv\AbstractCsv
Bakame\Csv\Writer::insertOne
takes into account CSV controlstoHTML
method takes into account encoding
Bakame\Csv\Writer
Bakame\Csv\Writer
andBakame\Csv\Reader
extendBakame\Csv\AbstractCsv
- Nothing
Bakame\Csv\Reader::fetchOne
is no longer deprecatedBakame\Csv\Reader::fetchCol
no longer accepts a third parameter$strict
Bakame\Csv\Codec
now the library is composer of 2 main classesBakame\Csv\Reader::getFile
Bakame\Csv\Reader::fetchValue
Bakame\Csv\Reader
no longer implements theArrayAccess
interface
Bakame\Csv\Reader
implementsIteratorAggregate
InterfaceBakame\Csv\Reader::createFromString
to create a CSV object from a raw stringBakame\Csv\Reader::query
accept an optional$callable
parameter
Bakame\Csv\Reader::getFile
in favor ofBakame\Csv\Reader::getIterator
Bakame\Csv\ReaderInterface
useless interface
Bakame\Csv\Reader::fetch*
$callable
parameter is normalized to accept an arrayBakame\Csv\Reader::fetchCol
accepts a third parameter$strict
Bakame\Csv\Reader
implements the following interfacesJsonSerializable
andArrayAccess
Bakame\Csv\Reader::toHTML
to output the CSV as a HTML tableBakame\Csv\Reader::setFilter
,Bakame\Csv\Reader::setSortBy
,Bakame\Csv\Reader::setOffset
,Bakame\Csv\Reader::setLimit
,Bakame\Csv\Reader::query
to perform SQL like queries on the CSV content.Bakame\Csv\Codec::setFlags
,Bakame\Csv\Codec::getFlags
, Bakame\Csv\Codec::__construct : add an optional$flags
parameter to enable the use ofSplFileObject
constants flags
Bakame\Csv\Reader::fetchOne
replaced byBakame\Csv\Reader::offsetGet
Bakame\Csv\Reader::fetchValue
useless method
Bakame\Csv\Reader::output
output the CSV data directly in the output bufferBakame\Csv\Reader::__toString
can be use to echo the raw CSV
Bakame\Csv\Reader::fetchAssoc
when users keys and CSV row data don't have the same length
Bakame\Csv\ReaderInterface
Bakame\Csv\Reader
class
Bakame\Csv\Codec::loadString
returns aBakame\Csv\Reader
objectBakame\Csv\Codec::loadFile
returns aBakame\Csv\Reader
objectBakame\Csv\Codec::save
returns aBakame\Csv\Reader
object
Bakame\Csv\CsvCodec
class renamedBakame\Csv\Codec
- Nothing
- Nothing
Bakame\Csv\Codec::create
from public API
Initial Release of Bakame\Csv