|
4 | 4 | The YAML Format |
5 | 5 | =============== |
6 | 6 |
|
7 | | -According to the official `YAML`_ website, YAML is "a human friendly data |
8 | | -serialization standard for all programming languages". |
9 | | - |
10 | | -Even if the YAML format can describe complex nested data structure, this |
11 | | -article only describes the minimum set of features needed to use YAML as a |
12 | | -configuration file format. |
13 | | - |
14 | | -YAML is a simple language that describes data. As PHP, it has a syntax for |
15 | | -simple types like strings, booleans, floats, or integers. But unlike PHP, it |
16 | | -makes a difference between arrays (sequences) and hashes (mappings). |
| 7 | +According to the official `YAML website`_, YAML is "a human friendly data |
| 8 | +serialization standard for all programming languages". The Symfony Yaml |
| 9 | +component implements a subset of the `YAML specification`_. Specifically, it |
| 10 | +implements the minimum set of features needed to use YAML as a configuration |
| 11 | +file format. |
17 | 12 |
|
18 | 13 | Scalars |
19 | 14 | ------- |
@@ -171,8 +166,8 @@ Collections |
171 | 166 | ----------- |
172 | 167 |
|
173 | 168 | A YAML file is rarely used to describe a simple scalar. Most of the time, it |
174 | | -describes a collection. A collection can be a sequence or a mapping of |
175 | | -elements. Both sequences and mappings are converted to PHP arrays. |
| 169 | +describes a collection. YAML collections can be a sequence (indexed arrays in PHP) |
| 170 | +or a mapping of elements (associative arrays in PHP). |
176 | 171 |
|
177 | 172 | Sequences use a dash followed by a space: |
178 | 173 |
|
@@ -318,4 +313,20 @@ The YAML specification defines some tags to set the type of any data explicitly: |
318 | 313 | Pz7Y6OjuDg4J+fn5OTk6enp |
319 | 314 | 56enmleECcgggoBADs= |
320 | 315 |
|
321 | | -.. _YAML: http://yaml.org/ |
| 316 | +Unsupported YAML Features |
| 317 | +------------------------- |
| 318 | + |
| 319 | +The following YAML features are not supported by the Symfony Yaml component: |
| 320 | + |
| 321 | +* Multi-documents (``---`` and ``...`` markers); |
| 322 | +* Complex mapping keys and complex values starting with ``?``; |
| 323 | +* Tagged values as keys; |
| 324 | +* The following tags and types: `!!set`, `!!omap`, `!!pairs`, `!!set`, `!!seq`, |
| 325 | + `!!bool`, `!!int`, `!!merge`, `!!null`, `!!timestamp`, `!!value`, `!!yaml`; |
| 326 | +* Tags (``TAG`` directive; example: ``%TAG ! tag:example.com,2000:app/``) |
| 327 | + and tag references (example: ``!<tag:example.com,2000:app/foo>``); |
| 328 | +* Using sequence-like syntax for mapping elements (example: ``{foo, bar}``; use |
| 329 | + ``{foo: ~, bar: ~}`` instead). |
| 330 | + |
| 331 | +.. _`YAML website`: http://yaml.org/ |
| 332 | +.. _`YAML specification`: http://www.yaml.org/spec/1.2/spec.html |
0 commit comments