You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
This encoder transforms arrays into CSV and vice versa.
Context
~~~~~~~
The ``encode()`` method defines a third optional parameter called ``context``
which defines the configuration options for the CsvEncoder an associative array::
$csvEncoder->encode($array, 'csv', $context);
These are the options available:
``csv_delimiter``
Sets the field delimiter separating values (one character only, default: ``,``).
``csv_enclosure``
Sets the field enclosure (one character only, default: ``"``).
``csv_escape_char``
Sets the escape character (at most one character, default: empty string).
``csv_key_separator``
Sets the separator for array's keys during its flattening (default: ``.``).
``csv_headers``
Sets the headers for the data (default: ``[]``, inferred from input data's keys).
``csv_escape_formulas``
Escapes fields containg formulas by prepending them with a ``\t`` character (default: ``false``).
``as_collection``
Always returns results as a collection, even if only one line is decoded.
``no_headers``
Disables header in the encoded CSV (default: ``false``).
``output_utf8_bom``
Outputs special `UTF-8 BOM`_ along with encoded data (default: ``false``).
.. versionadded:: 4.4
The ``output_utf8_bom`` option was introduced in Symfony 4.4.
Handling Constructor Arguments
------------------------------
Expand Down
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.