Release Notes

These are the release notes from Csv. We’ve tried to cover all changes, including backward compatible breaks from 5.0 through to the current stable release. If we’ve missed anything, feel free to create an issue, or send a pull request.

version 9.18.0 - 2024-10-18

Added

  • League\Csv\JsonConverter::chunkSize
  • League\Csv\AbstractCsv::download

Deprecated

  • League\Csv\AbstractCsv::output use League\Csv\AbstractCsv::download instead
  • League\Csv\FragmentFinder and derived methods are marked as experimental as their results will be changed in the next major version.

Fixed

  • League\Csv\JsonConverter::download the filename is now nullable
  • League\Csv\XMLConverter::download the filename is now nullable
  • League\Csv\JsonConverter::save throws a TypeError exception if the $destination type is not supported.

Remove

  • None

version 9.17.0 - 2024-10-10

Added

  • League\Csv\SwapDelimiter::apppendTo
  • League\Csv\SwapDelimiter::prependTo
  • League\Csv\CharsetConverter::apppendTo
  • League\Csv\CharsetConverter::prependTo
  • League\Csv\XMLConverter::download
  • League\Csv\JsonConverter
  • League\Csv\Constraint\Criteria::andNot
  • League\Csv\Constraint\Criteria::orNot
  • League\Csv\Constraint\Criteria::xorNot
  • League\Csv\Serializer\MapRecord attribute
  • adding the convertEmptyStringToNull options to MapCell and to MapRecord to improve string and null conversion
  • adding the trimFieldValueBeforeCasting options to MapCell and to MapRecord to improve string conversion
  • adding the trimElementValueBeforeCasting option to CasToArray to improve conversion during denormalization
  • adding the headerOffset option to CasToArray to improve conversion during denormalization. The optoon is only used with the CSV shape.

Deprecated

  • None

Fixed

  • Cast* methods accept more input type to improve Denormalization usage when Reader::addFormatter is used or when the collection contains data other than string and null.
  • Stream::getSize is added to the internal Stream class
  • Stream::getContents is added to the internal Stream class
  • MapIterator::toIterator is added to the internal class MapIterator class to convert any iterable into an Iterator.
  • Casting a CSV to an array it now will be a collection of array instead of a simple array.
  • Added the internal class HttpHeaders to improve file download throughout the codebase.

Removed

  • leage\csv-doctrine is no longer a sub-split of the main league/csv package.

version 9.16.0 - 2024-05-24

Added

  • Bom enum
  • Stream::ftell
  • Statement::orderByAsc
  • Statement::orderByDesc
  • Statement::andWhere
  • Statement::whereNot
  • Statement::orWhere
  • Statement::xorWhere
  • Statement::andWhereColumn
  • Statement::whereNotColumn
  • Statement::orWhereColumn
  • Statement::xorWhereColumn
  • Statement::andWhereOffset
  • Statement::whereNotOffset
  • Statement::orWhereOffset
  • Statement::xorWhereOffset
  • Query feature to allow easier filtering, ordering and querying tabular data

Deprecated

  • ByteSequence Interface use the Bom enum instead
  • Info::fetchBOMSequence use Bom::tryFromSequence instead
  • League\Csv\Doctrine use the new League\Csv\Constraint feature instead
  • League\Csv\Statement::create arguments; The method should be used without any argument at all. All arguments will be removed in the next major version.

Fixed

  • Reader and ResultSet docblocks
  • internal code uses Bom enum instead of Info::fetchBOMSequence
  • the AbstractCsv BOM related properties are moved to being Bom instances instead of nullable string.
  • setOutpuBOM will only accept valid BOM sequences all other values except the empty string will throw a ValueError exception;
  • The package no longer requires the ext-mbstring extension to work. But you should have it install in your system in order to use the mbstring related stream filters.
  • Issue #524 fix issue with ResultSet::chunkBy not working as documented.

Removed

  • None

version 9.15.0 - 2024-02-20

Added

  • Statement::select
  • TabularDataReader::getRecordsAsObject
  • TabularDataReader::chunkBy
  • TabularDataReader::mapHeader

Deprecated

  • TabularDataReader::getObjects use TabularDataReader::getRecordsAsObject instead

Fixed

  • Reader::select and ResultSet::select now internally use Statement::select
  • Statement should not throw when LimitIterator is used in combinaison with ArrayIterator.
  • Statement internal codebase improvement.
  • Using the $header argument on Statement::process is no longer deprecated. E_USER_DEPRECATED is no longer triggered.
  • BOM stripping no longer depends on the mbstring extension
  • TabularDataReader::fetchColumn is no longer deprecated

Removed

  • None

version 9.14.0 - 2023-12-29

Added

  • League\Csv\TabularDataReader::nthAsObject equivalent to nth but returns an object or null
  • League\Csv\TabularDataReader::firstAsObject equivalent to first but returns an object or null
  • League\Csv\Serializer\Denormalizer::types list all the registered types

Deprecated

  • None

Fixed

  • None

Removed

  • None

version 9.13.0 - 2023-12-16

Added

  • League\Csv\SwapDelimiter stream filter to allow working with multibyte CSV delimiter
  • League\Csv\Serializer\AfterMapping to work around the limitation of not using the class constructor during denormalization.
  • League\Csv\Serializer\Denormalizer to allow registering type alias to improve callback usage.
  • League\Csv\Serializer\MapCell has a new property ignore to allow ignoring a property or a method during denormalization.

Deprecated

  • None

Fixed

  • None

Removed

  • None

version 9.12.0 - 2023-12-01

Added

  • TabulatDataReader::value
  • TabulatDataReader::select
  • TabulatDataReader::getObjects
  • TabulatDataReader::matching
  • TabulatDataReader::matchingFirst
  • TabulatDataReader::matchingFirstOrFail
  • ResultSet::fromRecords
  • Stream::setMaxLineLen
  • Stream::getMaxLineLen
  • League\Csv\Serializer\Denormalizer to allow denormalizing records into objects #508
  • League\Csv\FragmentFinder to implement RFC7111

Deprecated

  • Using the $header argument on Statement::process is deprecated and will be removed in the next version. Use TabularDataReader::getRecords on the returned value instead. It’s usage will trigger a E_USER_DEPRECATED call.

Fixed

  • The optional $header argument for TabularDataReader;;getRecords becomes a full mapper between the records column offset and the column names #498
  • ResultSet constructor now allows the records to be an array.
  • The internal Stream object will throw a RuntimeException if the rewind action fails
  • if calls to fseek fails (returns -1 ) a RuntimeException will be thrown.
  • Stream can iterate and return the full line respecting SplFielObject flags. Previously it only returned the CSV records.
  • MapIterator::fromIterable to instantiate a MapIterator object from any iterable structure.

Removed

  • None

version 9.11.0 - 2023-09-23

Added

  • EscapeFormula::unescapeRecord does the opposite of EscapeFormula::escapeRecord
  • TabularReader::each
  • TabularReader::exists
  • TabularReader::reduce
  • TabularReader::filter
  • TabularReader::slice
  • TabularReader::sorted
  • Reader::addFormatter

All the methods from the TabularReader interface are implemented on the Reader and the ResultSet objects.

Deprecated

  • EscapeFormula::__invoke use EscapeFormula::__escapeRecord instead

Fixed

  • None

Removed

  • None

version 9.10.0 - 2023-08-04

Added

  • Writer::forceEnclosure and Writer::relaxEnclosure to control the presence of enclosure in the generated CSV
  • Writer::getEndOfLine and Writer::setEndOfLine

Deprecated

  • EncloseField stream filter in favor of the new Writer::forceEnclosure method.
  • Writer::getNewline and Writer::setNewline in favor of Writer::getEndOfLine and Writer::setEndOfLine

Fixed

  • Stream::fwrite to allow writing to a file in a normalized way. Internal use.
  • Documentation Fixed removing unreleased documented feature by @nclavaud

Removed

  • None

version 9.9.0 - 2023-03-11

Added

  • TabularDataWriter interface to represent how to write to a tabular data document.
  • TabularDataReader::first to replace TabularDataReader::fetchOne
  • TabularDataReader::nth to replace TabularDataReader::fetchOne
  • CharsetConverter::addBOMSkippingTo to improve BOM skipping see bug #483

Deprecated

  • TabularDataReader::fetchOne

Fixed

  • Stream::createFromResource
  • Stream::__construct is made private. The class is already marked as internal so BC break does not apply on it.

  • Using PHP8 feature to rewrite internal codebase
  • Replaced simple comparisons with strict comparison operator where types are obvious in internal codebase by @astepin
  • Marked class constants explicitly as public by @astepin
  • Minimal support version PHP8.1.2
  • Fix Docblock and method signature using PHP8 feature (Union Type)
  • Fix Internal codebase around seek usage and `#75917 requires PHP8.1.2
  • Remove internal usage of deprecated methods

Removed

  • Stream::fwrite The class is already marked as internal so BC break does not apply on it.
  • Stream::fgets The class is already marked as internal so BC break does not apply on it.
  • Drop support for PHP7 and PHP8.0
  • Polyfill to enable using fputcsv $eol argument

version 9.8.0 - 2022-01-04

Added

  • Added PHP7.4 typed properties where applicable
  • TabularDataReader::fetchColumnByName to replace TabularDataReader::fetchColumn
  • TabularDataReader::fetchColumnByOffset to replace TabularDataReader::fetchColumn

Deprecated

  • TabularDataReader::fetchColumn use TabularDataReader::fetchColumnByOffset or TabularDataReader::fetchColumnByName instead

Fixed

  • AbstractCsv constructor is marked final via docblock.
    The method should never be extended or changed in child classes to avoid unexpected behaviour

Removed

  • PHP7.3 support
  • Remove internal EmptyEscapeParser Polyfill used in Reader class
  • Remove PHP7.4 polyfill features in Writer class

version 9.7.4 - 2021-11-30

Added

  • None

Deprecated

  • None

Fixed

Removed

  • None

version 9.7.3 - 2021-11-21

Added

  • None

Deprecated

  • None

Fixed

  • Update PHPStan requirement for development
  • Improve Documentation generation thanks to pdelre
  • PHP8.1 compliance: using ReturnTypeWillChange to avoid emitting a unnecessary deprecation notice. thanks to cedric-anne

Removed

  • None

version 9.7.2 - 2021-10-05

Added

  • None

Deprecated

  • None

Fixed

  • Update dependencies requirement for development
  • PHP8.1 compliance: replace FILTER_SANITIZE_STRING by FILTER_UNSAFE_RAW
  • PHP8.1 compliance: remove duplicated public properties declaration
  • PHP8.1 compliance: add support for fputcsv $eol argument

Removed

  • None

version 9.7.1 - 2021-04-17

Added

  • None

Deprecated

  • None

Fixed

Removed

  • None

version 9.7.0 - 2021-03-26

Added

  • League\Csv\SyntaxError::duplicateColumnNames to expose column name duplicates during header usage
  • League\Csv\UnableToProcessCsv as the new Exception Marker Interface
  • League\Csv\UnavailableStream as the new Exception
  • League\Csv\Info::getDelimiterStats to replace the namespace function delimiter_detect
  • League\Csv\Info::fetchBOMSequence to replace the namespace function bom_match
  • League\Csv\AbstractCsv::toString to replace League\Csv\AbstractCsv::getContent and League\Csv\AbstractCsv::__toString
  • League\Csv\XMLConverter::create to replace League\Csv\XMLConverter::__construct
  • League\Csv\HTMLConverter::create to replace League\Csv\HTMLConverter::__construct
  • League\Csv\AbstractCsv::supportsStreamFilterOnRead and League\Csv\AbstractCsv::supportsStreamFilterOnWrite to replace League\Csv\AbstractCsv::supportsStreamFilter and League\Csv\AbstractCsv::getStreamFilterMode

Deprecated

  • League\Csv\delimiter_detect use League\Csv\Info::getDelimiterStats
  • League\Csv\bom_match use League\Csv\Info::fetchBOMSequence
  • League\Csv\AbstractCsv::getContent use League\Csv\AbstractCsv::toString
  • League\Csv\AbstractCsv::getStreamFilterMode use League\Csv\AbstractCsv::supportsStreamFilterOnRead or League\Csv\AbstractCsv::supportsStreamFilterOnWrite
  • League\Csv\AbstractCsv::supportsStreamFilter use League\Csv\AbstractCsv::supportsStreamFilterOnRead or League\Csv\AbstractCsv::supportsStreamFilterOnWrite
  • Calling exceptions constructor, use named constructors instead.
  • League\Csv\XMLConverter::__construct use League\Csv\XMLConverter::create
  • League\Csv\HTMLConverter::__construct use League\Csv\HTMLConverter::create

Fixed

  • Move tests into the src directory
  • Fixed encoder method resolver implementation
  • all classes marked as @internal are now final
  • League\Csv\AbstractCsv::STREAM_FILTER_MODE constant replaces League\Csv\AbstractCsv::$stream_filter_mode

Removed

  • Support for PHP7.2
  • League\Csv\AbstractCsv::$stream_filter_mode

version 9.6.2 - 2020-12-10

Added

  • Using Github actions as development tools.

Deprecated

  • None

Fixed

Removed

  • Removing Travis and Scrutinizr as development tools

version 9.6.1 - 2020-09-05

Added

  • None

Deprecated

  • None

Fixed

  • BOM sequence processing fix #394

Removed

  • None

version 9.6.0 - 2020-03-17

Added

  • More return types and type parameters as supported in PHP7.2+
  • League\Csv\Statement::create named constructor to ease constraint builder instantiation
  • League\Csv\Statement can now also process League\Csv\ResultSet instances.
  • League\Csv\TabularDataReader interface to represent how to read tabular data
  • League\Csv\ResultSet::getRecords has an optional $header second argument to make the method works like League\Csv\Reader::getRecords
  • League\Csv\ResultSet::createFromTabularDataReader create a new instance from League\Csv\TabularDataReader implementing class.

Deprecated

  • Nothing

Fixed

  • League\Csv\Reader no longer uses __call to implement fetchOne, fetchPairs and fetchColumn methods.

Removed

  • Internal polyfill for is_iterable
  • Internal polyfill for is_nullable_int
  • Support for PHP7.0 and PHP7.1

version 9.5.0 - 2019-12-15

Added

  • Improve package exception throwing by adding new exceptions classes that extends the League\Csv\Exception exception marker class #360, #361 feature proposed and developed by Darren Miller
    • League\Csv\UnavailableFeature
    • League\Csv\InvalidArgument
    • League\Csv\SyntaxError

Deprecated

  • Nothing

Fixed

  • bug fix bom_match function see issue #363 resolved based on PR from Jerry Martinez
  • bug fix delemiter_detect function see issue #366

Removed

  • Nothing

version 9.4.1 - 2019-10-17

Added

  • Nothing

Deprecated

  • Nothing

Fixed

  • bug fix the escape mechanism polyfill #358 fix provided by on2

Removed

  • Nothing

version 9.4.0 - 2019-10-02

Added

  • Adding support for controlling empty record presence in Reader::getRecords return value.
    • Reader::includeEmptyRecords
    • Reader::skipEmptyRecords
    • Reader::isEmptyRecordsIncluded
  • Adding support for controlling Input BOM usage in the library:
    • AbstractCsv::skipInputBOM
    • AbstractCsv::includeInputBOM
    • AbstractCsv::isInputBOMIncluded

Deprecated

  • Nothing

Fixed

  • EmptyEscapeParser::parse no longer auto skip empty records

Removed

  • Nothing

version 9.3.0 - 2019-07-30

Added

  • XMLConverter::import see #348 thanks @kusabi
  • Support for thead, tfoot and tbody in HTMLConverter::convert via the addition of protected methods HTMLConverter::addHTMLAttributes and HTMLConverter::appendHeaderSection #348 thanks @kusabi

Deprecated

  • Nothing

Fixed

  • Internal improvement in Reader dockblock thanks @ghobaty.
  • Improve strict comparison when using preg_match.
  • Improve CSV control in Stream.

Removed

  • Nothing

version 9.2.1 - 2019-06-08

Added

  • Nothing

Fixed

  • AbstractCSV::chunk see #325 remove CSV flags from the Stream class to avoid infinite loop.
  • Internal improve HTMLConverter.

Deprecated

  • Nothing

Removed

  • Nothing

version 9.2.0 - 2019-03-08

Added

  • Supports for PHP7.4 empty string for the escape character.
  • Supports for empty string for the escape character with a polyfill for PHP7.4- versions.
  • AbstractCSV::getPathname see #321 thanks @tomkyle

Deprecated

  • League\Csv\RFC4180Field use AbstractCSV::setEscape method with an empty string instead.

Fixed

  • AbstractCSV::__construct correctly initializes properties
  • AbstractCSV::createFromString named constructor default argument is now the empty string
  • AbstractCSV::setEscape now accepts the empty string like fputcsv and fgetcsv
  • Writer::insertOne fixes throwing exception when record can not be inserted
  • XMLConverter convert to string the record value to avoid PHP warning on null value
  • Internal Stream::createFromString named constructor default argument is now the empty string
  • Internal Stream::fwrite improved
  • Internal Stream::__destruct no longer emit warning on invalid stream filter removal.
  • Internal Stream::seek returns 0 if the seeked position 0 is valid see #321 thanks @HaozhouChen

  • Reader:getHeader when the record is an empty line.

Removed

  • Nothing

version 9.1.4 - 2018-05-01

Added

  • Nothing

Deprecated

  • Nothing

Fixed

  • Writer::setFlushThreshold should accept 1 as an argument #289

  • CharsetConverter::convert should not try to convert numeric value #287

Removed

  • Nothing

version 9.1.3 - 2018-03-12

Added

  • Nothing

Deprecated

  • Nothing

Fixed

  • Writer::insertOne allow empty array to be added to the CSV (allow inserting empty row)
  • Removed all return type from named constructor see #285
  • Added PHPStan for static code analysis

Removed

  • Nothing

version 8.2.3 - 2018-02-06

Added

  • None

Deprecated

  • None

Fixed

  • Reader::fetchAssoc no longer throws exception because of a bug in PHP7.2+ issue #279

Removed

  • None

version 9.1.2 - 2018-02-05

Added

  • Nothing

Deprecated

  • Nothing

Fixed

  • is_iterable polyfill for PHP7.0
  • Reader::getHeader no longer throws exception because of a bug in PHP7.2+ issue #279

Removed

  • Nothing

version 9.1.1 - 2017-11-28

Added

  • Nothing

Deprecated

  • Nothing

Fixed

  • issue with error_get_last usage when using a modified PHP error handler see #254 - fixed by @csiszarattila

  • Removed seekable word from Stream exception messages.

Removed

  • Nothing

version 9.1.0 - 2017-10-20

Added

  • Support for non seekable stream. When seekable feature are required an exceptions will be thrown.
  • League\Csv\EncloseField to force enclosure insertion on every field. #269
  • League\Csv\EscapeFormula a League CSV formatter to prevent CSV Formula Injection in Spreadsheet programs.
  • League\Csv\RFC4180Field::addTo accept an option $replace_whitespace argument to improve RFC4180 compliance.
  • League\Csv\Abstract::getContent to replace League\Csv\Abstract::__toString. The __toString method may trigger a Fatal Error with non seekable stream, instead you are recommended to used the new getContent method which will trigger an exception instead.

Deprecated

  • League\Csv\Abstract::__toString use League\Csv\Abstract::getContent instead. the __toString triggers a Fatal Error when used on a non-seekable CSV document. use the getContent method instead which will trigger an exception instead.

Fixed

  • Bug fixes headers from AbstractCsv::output according to RFC6266 #250
  • Make sure the internal source still exists before closing it #251
  • Make sure the Reader::createFromPath default open mode is r see #258 and #266

Removed

  • Nothing

version 9.0.1 - 2017-08-22

Added

  • Nothing

Deprecated

  • Nothing

Fixed

  • CSV controls not applied when calling Writer::insertOne see issue #244

Removed

  • Nothing

version 9.0.0 - 2017-08-18

Added

  • Improved CSV Records selection
    • League\Csv\Reader::getRecords to access all CSV records
    • League\Csv\Statement provides a constraint builder to select CSV records.
    • League\Csv\ResultSet represents the result set of the selected CSV records.
    • League\Csv\delimiter_detect function to detect CSV delimiter character
  • Improved CSV document header selection.
    • League\Csv\Reader::getHeader
    • League\Csv\Reader::getHeaderOffset
    • League\Csv\Reader::setHeaderOffset
  • Improved CSV Records conversion
    • League\Csv\CharsetConverter converts CSV records charset.
    • League\Csv\XMLConverter converts CSV records into DOMDocument
    • League\Csv\HTMLConverter converts CSV records into HTML table.
  • Improved Exception handling
    • League\Csv\Exception the default exception
    • League\Csv\CannotInsertRecord
  • Improved CSV document output
    • League\Csv\AbstractCsv::chunk method to output the CSV document in chunk
    • League\Csv\bom_match function to detect BOM sequence in a given string
    • League\Csv\ByteSequence interface to decoupled BOM sequence from CSV documents
  • Improved CSV records column count consistency on insertion
    • League\Csv\ColumnConsistency
  • Improved CSV document flush mechanism on insertion
    • League\Csv\Writer::setFlushThreshold
    • League\Csv\Writer::getFlushThreshold
  • Improve RFC4180 compliance
    • League\Csv\RFC4180Field to format field according to RFC4180 rules

Deprecated

  • Nothing

Fixed

  • Improved CSV record insertion
    • League\Csv\Writer::insertOne only accepts an array and returns a integer
    • League\Csv\Writer::insertAll only accepts an iterable of array and returns an integer
  • Normalized CSV offset returned value
    • League\Csv\Reader::fetchColumn always returns the CSV document original offset.

Removed

  • examples directory
  • PHP5/HHVM support
  • The following method is removed because The BOM sequence is now automatically stripped:
    • League\Csv\AbstractCsv::stripBOM
  • All conversion methods are removed in favor of conversion classes:
    • League\Csv\Writer::jsonSerialize
    • League\Csv\AbstractCsv::toHTML
    • League\Csv\AbstractCsv::toXML
    • League\Csv\AbstractCsv::setInputEncoding
    • League\Csv\AbstractCsv::getInputEncoding
  • The following methods are removed because the PHP stream filter API is simplified:
    • League\Csv\AbstractCsv::isActiveStreamFilter
    • League\Csv\AbstractCsv::setStreamFilterMode
    • League\Csv\AbstractCsv::appendStreamFilter
    • League\Csv\AbstractCsv::prependStreamFilter
    • League\Csv\AbstractCsv::removeStreamFilter
    • League\Csv\AbstractCsv::clearStreamFilters
  • The following methods are removed because switching between connections is no longer possible:
    • League\Csv\AbstractCsv::newReader
    • League\Csv\AbstractCsv::newWriter
    • League\Csv\Reader::getNewline
    • League\Csv\Reader::setNewline
  • The Exception mechanism is improved thus the following class is removed:
    • League\Csv\Exception\InvalidRowException;
  • The CSV records filtering methods are removed in favor of the League\Csv\Statement class:
    • League\Csv\AbstractCsv::addFilter,
    • League\Csv\AbstractCsv::addSortBy,
    • League\Csv\AbstractCsv::setOffset,
    • League\Csv\AbstractCsv::setLimit;
  • The following methods are removed as CSV records selection is simplified:
    • League\Csv\Reader::each
    • League\Csv\Reader::fetch
    • League\Csv\Reader::fetchAll
    • League\Csv\Reader::fetchAssoc
    • League\Csv\Reader::fetchPairsWithoutDuplicates
  • Formatting and validating CSV records on insertion is simplified, the following methods are removed:
    • League\Csv\Writer::hasFormatter
    • League\Csv\Writer::removeFormatter
    • League\Csv\Writer::clearFormatters
    • League\Csv\Writer::hasValidator
    • League\Csv\Writer::removeValidator
    • League\Csv\Writer::clearValidators
  • The following Formatters and Validators classes are removed from the package:
    • League\Csv\Plugin\SkipNullValuesFormatter
    • League\Csv\Plugin\ForbiddenNullValuesValidator
    • League\Csv\Plugin\ColumnConsistencyValidator replace by League\Csv\ColumnConsistency
  • League\Csv\Writer no longers implements the IteratorAggregate interface
  • League\Csv\AbstractCsv::fetchDelimitersOccurrence is removed replace by League\Csv\delimiter_detect function

version 8.2.2 - 2017-07-12

Added

  • None

Deprecated

  • None

Fixed

  • Writer::insertOne was silently failing when inserting record in a CSV document in non-writing mode.
  • bug fix docblock

Removed

  • None

version 8.2.1 - 2017-02-23

Added

  • None

Deprecated

  • None

Fixed

  • internal Reader::getRow when using a StreamIterator issue #213
  • Removed @deprecated from selected methods issue #208

Removed

  • None

version 8.2.0 - 2017-01-25

Added

  • AbstractCsv::createFromStream to enable working with resource stream issue #202

Deprecated

  • League\Csv\AbstractCsv::stripBom
  • League\Csv\Reader::getOffset
  • League\Csv\Reader::getLimit
  • League\Csv\Reader::getSortBy
  • League\Csv\Reader::getFilter
  • League\Csv\Reader::setOffset
  • League\Csv\Reader::setLimit
  • League\Csv\Reader::addSortBy
  • League\Csv\Reader::addFilter
  • League\Csv\Reader::fetch
  • League\Csv\Reader::each
  • League\Csv\Reader::fetchPairsWithoutDuplicates
  • League\Csv\Reader::fetchAssoc
  • League\Csv\Writer::removeFormatter
  • League\Csv\Writer::hasFormatter
  • League\Csv\Writer::clearFormatters
  • League\Csv\Writer::removeValidator
  • League\Csv\Writer::hasValidator
  • League\Csv\Writer::clearValidators
  • League\Csv\Writer::jsonSerialize
  • League\Csv\Writer::toHTML
  • League\Csv\Writer::toXML

Fixed

  • None

Removed

  • None

version 8.1.2 - 2016-10-27

Added

  • None

Deprecated

  • None

Fixed

  • BOM filtering fix issue #184
  • AbstractCsv::BOM_UTF32_LE value fixed

Removed

  • None

version 8.1.1 - 2016-09-05

Fixed

  • getInputBOM method name is now consistent everywhere in the API PR #171
  • preserve fileObject CSV controls commit #8a20c56
  • Change output method header content-type value to text/csv PR #175

version 8.1.0 - 2016-05-30

Added

  • The package now includes its own autoloader.
  • Ouput::getInputEncoding
  • Ouput::setInputEncoding

Deprecated

  • Ouput::getEncodingFrom replaced by Ouput::getInputEncoding
  • Ouput::setEncodingFrom replaced by Ouput::setInputEncoding

Fixed

  • Stream Filters are now url encoded before usage issue #72
  • All internal parameters are now using the snake case format

version 8.0.0 - 2015-12-11

Added

  • Reader::fetchPairs
  • Reader::fetchPairsWithoutDuplicates

Deprecated

  • None

Fixed

  • Reader::fetchColumn and Reader::fetchAssoc now return Iterator
  • Reader::fetchAssoc callable argument expects an indexed row using the submitted keys as its first argument
  • Reader::fetchColumn callable argument expects the selected column value as its first argument
  • Default value on setOutputBOM is removed
  • AbstractCsv::getOutputBOM always return a string
  • AbstractCsv::getInputBOM always return a string

Removed

  • Controls::setFlags
  • Controls::getFlags
  • Controls::detectDelimiterList
  • QueryFilter::removeFilter
  • QueryFilter::removeSortBy
  • QueryFilter::hasFilter
  • QueryFilter::hasSortBy
  • QueryFilter::clearFilter
  • QueryFilter::clearSortBy
  • Reader::query
  • The $newline argument from AbstractCsv::createFromString

Please refers to the documentation or the library CHANGELOG for more details and a complete list of changes

version 7.2.0 - 2015-11-02

Added

  • Reader::fetch replaces League\Csv\Reader::query for naming consistency
  • Controls::fetchDelimitersOccurrence to replace Controls::detectDelimiterList the latter gives erronous results

Deprecated

  • Controls::detectDelimiterList
  • Reader::query
  • The $newline argument from AbstractCsv::createFromString is deprecated

Fixed

  • Streamming feature no longer trim filter name argument issue #122
  • Fix default SplFileObject flags usage PR #130
  • AbstractCsv::createFromString no longer trim the submitted string issue #132

Removed

  • Nothing

Please refers to the documentation or the library CHANGELOG for more details and a complete list of changes

version 7.1.2 - 2015-06-10

Fixed

  • Enclosures should be removed when a BOM sequence is stripped bug fix #102

Please refers to the documentation or the library CHANGELOG for more details and a complete list of changes

version 7.1.1 - 2015-05-21

Fixed

  • SplFileObject flags were not always applied using query filter bug fix #99

Please refers to the documentation or the library CHANGELOG for more details and a complete list of changes

version 7.1.0 - 2015-05-06

Added

  • 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.

Fixed

Please refers to the documentation or the library CHANGELOG for more details and a complete list of changes

version 7.0.1 - 2015-03-23

Fixed

  • setFlags: SplFileObject::DROP_NEW_LINE can be remove using setFlags method.

Please refers to the documentation or the library CHANGELOG for more details and a complete list of changes

version 7.0.0 - 2015-02-19

Added

  • A new flexible mechanism to format and validate a row before its insertion by adding

Fixed

  • jsonSerialize, toXML and toHTML output can be modified using Reader query options methods. #66
  • detectDelimiterList index keys now represents the occurrence of the found delimiter.
  • the named constructor createFromString now accepts the $newline sequence as a second argument.
  • Default SplFileObject flags value is now SplFileObject::READ_CSV|SplFileObject::DROP_NEW_LINE
  • All CSV properties are now copied when using newReader and newWriter methods

Removed

  • ini_set("auto_detect_line_endings", true); setting is no longer set in the class constructor. Mac OS X users must explicitly set this ini options in their script.
  • Writer and Reader 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 insertion.

Please refers to the documentation or the library CHANGELOG for more details and a complete list of changes

version 6.3.0 - 2015-01-21

Added AbstractCSV::getInputBOM , AbstractCSV::getOutputBOM, AbstractCSV::setOutputBOM methods to control the BOM character added at the top of each CSV.

Please refers to the documentation or the library CHANGELOG for more details.

version 6.2.0 - 2014-12-12

Added Writer::setNewline , Writer::getNewline to control the newline sequence characters added at the end of each inserted CSV row.

Please refers to the documentation or the library CHANGELOG for more details

version 6.1.0 - 2014-12-08

Added

  • Reader::fetchAssoc now also accepts an integer as first argument representing a row index.

version 6.0.1 - 2014-11-12

  • bug fix AbstractCsv::detectDelimiterList

version 6.0.0 - 2014-08-28

New API

  • Stream Filter API added to enable the use of PHP stream filters on CSV objects.

New Methods

  • To simplify CSV objects instantiation new named constructors are added League\Csv\AbstractCsv::createFromPath and League\Csv\AbstractCsv::createFromFileObject
  • New methods allow creating CSV objects from already created CSV objects: League\Csv\AbstractCsv::newWriter and League\Csv\AbstractCsv::newReader methods can be call on both classes

Bug Fixes

  • League\Csv\Reader::each is now more strict $callable MUST returns true

Removed Methods

  • League\Csv\AbstractCsv::detectDelimiter replaced by League\Csv\AbstractCsv::detectDelimiterList
  • League\Csv\AbstractCsv::set/getEncoding replaced by League\Csv\AbstractCsv::set/getEncodingFrom
  • League\Csv\Reader::getWriter replaced by League\Csv\AbstractCsv::newWriter
  • League\Csv\Writer::getReader replaced by League\Csv\AbstractCsv::newReader
  • League\Csv\Reader::setSortBy deprecated since version 5.2
  • League\Csv\Reader::setFilter deprecated since version 5.1

Miscellaneous

  • Since HHVM 3.2+ supports PHP FilterCallbackIterator, the library now works on HHVM.
  • Code quality improved
  • Adding a changelog to the library

Please refers to the documentation or the library CHANGELOG for more details

version 5.4.0 - 2014-04-17

New Methods

the \League\Csv\Writer class gets 3 new methods to deal with issue #34

  • Writer::setColumnsCount
  • Writer::getColumnsCount
  • Writer::autodetectColumnsCount

To deal with column consistency check when inserting rows.

Deprecated Method

the \League\Csv\Reader::fetchCol method is renamed the \League\Csv\fetchColumn. The old method remains as a alias of the new method but will be remove on the next major version release. The change is made to add consistency with the new Writer methods.

Please refers to the documentation to see how the new methods work.

version 5.3.1 - 2014-04-10

  • bug fixes in League\Csv\AbstractCSV
  • internal code refactoring
  • now League\Csv\Reader and League\Csv\Writer class both use the r+ $open_mode by default

version 5.3.0 - 2014-03-24

New methods

Writer::setNullHandlingMode and Writer::getNullHandlingMode to better handle null insertion and/or conversion into a CSV field data #28

Bug fix

You don’t need to set the ini_set("auto_detect_line_endings", true); anymore has the library will automatically do it for you. It is needed to be correctly work with a CSV built on a OSX machines.

This version features also internal code improvements.

Please refers to the official documentation for a full explication on the new features.

version 5.2.0 - 2014-03-13

New methods

  • Reader::addSortBy, Reader::removeSortBy, Reader::hasSortBy, Reader::clearSortByto enhance sorting capabilities #12
  • Reader::clearFilterto enhance filtering capabilities #11

Improved Methods

  • Reader::setOffset now default to 0;
  • Reader::setLimit now default to -1;

Bug fix

  • AbstractCsv::detectDelimiter #16

Deprecated methods

  • Reader::setSortBy is deprecated and will be remove in the next major release. The method is now an alias of Reader::addSortBy. #12

Please review the documentation for more details on how to use these new features

version 5.1.0 - 2014-03-11

New methods

  • Reader::each to apply a callable to each CSV row
  • Reader::addFilter, Reader::removeFilter, Reader::hasFilter to enhance filtering capabilities
  • Reader::detectDelimiter and Writer::detectDelimiter to ease working with unknown CSV data

Deprecated methods

  • Reader::setFilter is deprecated and will be remove in the next major release. The method is now an alias of Reader::addFilter.

Please review the documentation for more details on how to use these new features

version 5.0.0 - 2014-02-28

  • Updated to reflect new GitHub username (changed from nyamsprod to thephpleague).
  • Updated to reflect new namespace (changed from Bakame to League).

version 4.2.1 - 2014-02-22

Bug Fix

Remove $open_mode validation. Now the validation is done by PHP Internals

New Traits

\Bakame\Csv\Iterator\IteratorFilter to enable Iterator filtering \Bakame\Csv\Iterator\IteratorSortBy to enable Iterator sorting \Bakame\Csv\Iterator\IteratorInterval to enable setting Iterator intervals

Update Trait

\Bakame\Csv\Iterator\IteratorQuery uses all the new Traits to enable CSV filtering

version 4.2.0 - 2014-02-17

New Trait

\Bakame\Csv\ConverterTrait to better deal with Csv conversion

New Method

  • \Bakame\Csv\AbstractCsv::toXML which convert the Csv into a DomDocument object

Method improved

  • \Bakame\Csv\AbstractCsv::toHTML
  • \Bakame\Csv\AbstractCsv::jsonSerialize
  • \Bakame\Csv\AbstractCsv::output now can take a optional $filename argument. When present the function will output all needed HTTP headers.
  • \Bakame\Csv\AbstractCsv::getIterator method improved
  • \Bakame\Csv\Reader::fetchCol method now default to $columnIndex = 0
  • \Bakame\Csv\Reader::fetchOne method now default to $offset = 0

version 4.1.2 - 2014-02-16

  • Adding PHP 5.6 test in travis.yml
  • Dropping PSR-0 in favor of PSR-4

version 4.1.1 - 2014-02-14

  • \Bakame\Csv\Reader methods improved
  • \Bakame\Csv\AbstractCsv::jsonSerialize method improved

Documentation and Examples improved

version 4.1.0 - 2014-02-07

New Methods:

  • \Bakame\Csv\AbstractCsv::setEncoding set the CSV encoding type
  • \Bakame\Csv\AbstractCsv::getEncoding get the CSV encoding type

Update:

  • The \Bakame\Csv\AbstractCsv::createFromString improved
  • The \Bakame\Csv\AbstractCsv::insertOne improved to take into account CSV controls
  • The \Bakame\Csv\AbstractCsv::toHTML improved to take into account the encoding type

The example directory is also rewritten with more explanations

version 4.0.0 - 2014-02-05

New Class

\Bakame\Csv\Writer to help creating and updating CSV file.

New Abstract

\Bakame\Csv\AbstractCsv abstract class is the new parent for:

  • the \Bakame\Csv\Reader
  • the \Bakame\Csv\Writer

This class implements the IteratorAggregate and the JsonSerializable interfaces and has a __toString method. (see the README file to have a complete list of methods shared between \Bakame\Csv\Reader and \Bakame\Csv\Writer).

New Trait

\Bakame\Csv\Traits\IteratorQuery is used in \Bakame\Csv\Reader to enable CSV filtering.

New Methods

  • the \Bakame\Csv\Writer::insertOne to insert one line into a CSV.
  • the \Bakame\Csv\Writer::insertAll to insert many lines into a CSV.

Changed Methods:

  • \Bakame\Csv\Reader::fetchCol no longer accept a third option $strict
  • \Bakame\Csv\Reader::fetchOne to read a single line of the CSV.(this method was deprecated in version 3.2.0 . But it is no longer deprecated and comes with a better implementation)

Removed Interface

  • \Bakame\Csv\ReaderInterface

Remove Class

  • \Bakame\Csv\Codec

Remove Traits

  • \Bakame\Csv\Traits\CsvControls (now this is done by \Bakame\Csv\AbstractCsv)
  • \Bakame\Csv\Traits\CsvOutput (now this is done by \Bakame\Csv\AbstractCsv)

Remove methods

  • \Bakame\Csv\Reader no longer implements the ArrayAccess interface
  • \Bakame\Csv\Reader::getFile
  • \Bakame\Csv\Reader::fetchValue

The library comes bundle with examples to help the developer see the classes in action.

version 3.3.0 - 2014-01-28

New Traits

The Library is restructured and Traits are placed in their own subdirectory

  • \Bakame\Csv\Traits\CsvControls to set/get Csv controls flags
  • \Bakame\Csv\Traits\CsvOutput to output in different forms the CSV

New Interfaces:

  • The \Bakame\Csv\Reader implements the IteratorAggregate Interface

New Methods:

  • \Bakame\Csv\Reader::createFromString this static function returns a new \Bakame\Csv\Reader object from a string
  • The \Bakame\Csv\Reader::getIterator is introduce and will replace \Bakame\Csv\Reader::getFile

Update:

  • The \Bakame\Csv\Reader::query has a new optional parameter $callable format the given iterator rows
  • The \Bakame\Csv\Reader::fetch* $callable parameter is now normalized to accept an array
  • The \Bakame\Csv\Reader::fetchCol now accept a third option $strict which is a boolean. By default $strict is false and the method behaviour remained the same. If $strict is true, the method will filter out the rows that do not contain the specified column index.

Deprecated

  • The \Bakame\Csv\Reader::getFile is deprecated and is to be remove in the next major point release

Removed

  • The \Bakame\Csv\ReaderInterface is removed as it was useless

version 3.2.0 - 2014-01-16

New Interfaces:

  • The \Bakame\Csv\Reader implements the JsonSerializable Interface
  • The \Bakame\Csv\Reader implements the ArrayAccess Interface

New Methods:

  • \Bakame\Csv\Reader::toHTML returns the CSV as a html table
  • \Bakame\Csv\Reader::setFilter adds filtering capabilities to \Bakame\Csv\Reader
  • \Bakame\Csv\Reader::setSortBy adds sorting capabilities to \Bakame\Csv\Reader
  • \Bakame\Csv\Reader::setOffset and \Bakame\Csv\Reader::setLimit add limiting capabilities to \Bakame\Csv\Reader
  • \Bakame\Csv\Reader::query adds manual filtering capabilities
  • The \Bakame\Csv\Codec adds setter and getter methods for the $flags property.

Update:

  • The \Bakame\Csv\Codec constructor has a new optional parameter $flags to set the splFileObject flag property

Deprecated

  • The \Bakame\Csv\Reader::fetchOne and \Bakame\Csv\Reader::fetchValue are deprecated and are to be remove in the next major point release

version 3.1.0 - 2014-01-14

New Methods:

  • The \Bakame\Csv\Reader::output output the CSV data directly in the output buffer
  • The \Bakame\Csv\Reader::__toString can be use to echo the raw CSV

Update:

  • The \Bakame\Csv\Reader::fetch* methods arguments are better validated

version 3.0.1 - 2014-01-10

  • Fix Bug on Bakame\Csv\Reader::fetchAssoc when users keys and CSV row data don’t have the same length.

version 3.0.0 - 2014-01-10

  • A new Class \Bakame\Csv\Reader is introduced to ease CSV data reading.
  • The \Bakame\Csv\Codec::loadString now return a \Bakame\Csv\Reader object
  • The \Bakame\Csv\Codec::loadFile now return a \Bakame\Csv\Reader object
  • The \Bakame\Csv\Codec::save now return a \Bakame\Csv\Reader object

version 2.0.0 - 2014-01-09

  • Class name changed from \Bakame\CSV\CsvCodec to \Bakame\CSV\Codec;
  • \Bakame\CSV\Codec::create method visibility changed from public to private;
  • Data formating prior to saving updated to simplify code maintenance;

version 1.0.0 - 2013-12-03

Initial Release for Bakame/Csv