@@ -25,17 +25,35 @@ Built-in Encoders
25
25
26
26
The Serializer component provides built-in encoders:
27
27
28
- * :class: `Symfony\\ Component\\ Serializer\\ Encoder\\ CsvEncoder ` to encode/decode CSV
29
- * :class: `Symfony\\ Component\\ Serializer\\ Encoder\\ JsonEncoder ` to encode/decode JSON
30
- * :class: `Symfony\\ Component\\ Serializer\\ Encoder\\ XmlEncoder ` to encode/decode XML
31
- * :class: `Symfony\\ Component\\ Serializer\\ Encoder\\ YamlEncoder ` to encode/decode Yaml
28
+ :class: `Symfony\\ Component\\ Serializer\\ Encoder\\ JsonEncoder `
29
+ This class encodes and decodes data in JSON _.
30
+
31
+ :class: `Symfony\\ Component\\ Serializer\\ Encoder\\ XmlEncoder `
32
+ This class encodes and decodes data in XML _.
33
+
34
+ :class: `Symfony\\ Component\\ Serializer\\ Encoder\\ YamlEncoder `
35
+ This encoder encodes and decodes data in YAML _. This encoder requires the
36
+ :doc: `Yaml Component </components/yaml >`.
37
+
38
+ :class: `Symfony\\ Component\\ Serializer\\ Encoder\\ CsvEncoder `
39
+ This encoder encodes and decodes data in CSV _.
40
+
41
+ All these encoders are enabled by default when using the Symfony Standard Edition
42
+ with the serializer enabled.
32
43
33
44
The ``JsonEncoder ``
34
45
~~~~~~~~~~~~~~~~~~~
35
46
36
47
The ``JsonEncoder `` encodes to and decodes from JSON strings, based on the PHP
37
48
:phpfunction: `json_encode ` and :phpfunction: `json_decode ` functions.
38
49
50
+ The ``CsvEncoder ``
51
+ ~~~~~~~~~~~~~~~~~~~
52
+
53
+ The ``CsvEncoder `` encodes to and decodes from CSV.
54
+
55
+ You can pass the context key ``as_collection `` in order to have the results always as a collection.
56
+
39
57
The ``XmlEncoder ``
40
58
~~~~~~~~~~~~~~~~~~
41
59
@@ -64,6 +82,8 @@ Be aware that this encoder will consider keys beginning with ``@`` as attributes
64
82
// <foo bar="value" />
65
83
// </response>
66
84
85
+ You can pass the context key ``as_collection `` in order to have the results always as a collection.
86
+
67
87
The ``YamlEncoder ``
68
88
~~~~~~~~~~~~~~~~~~~
69
89
0 commit comments