Skip to content

Commit 9310d78

Browse files
[Yaml] Mention php/const and php/object
1 parent 7ee76d0 commit 9310d78

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

reference/formats/yaml.rst

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,28 @@ The YAML specification defines some tags to set the type of any data explicitly:
321321
Pz7Y6OjuDg4J+fn5OTk6enp
322322
56enmleECcgggoBADs=
323323
324+
Symfony Specific Tags
325+
~~~~~~~~~~~~~~~~~~~~~
326+
327+
The YAML component provides a few additional tags that brings a few
328+
features when parsed in your PHP code:
329+
330+
* ``!php/const`` allows to use a constant name defined in a PHP file. This
331+
tag takes a constant FQCN as its argument:
332+
333+
.. code-block:: yaml
334+
335+
data:
336+
page_limit: !php/const App\Pagination\Paginator::PAGE_LIMIT
337+
338+
* ``!php/object`` allows to pass the serialized representation of a PHP
339+
object, which will be deserialized when the parsing is done:
340+
341+
.. code-block:: yaml
342+
343+
data:
344+
my_object: !php/object 'O:8:"stdClass":1:{s:3:"bar";i:2;}'
345+
324346
Unsupported YAML Features
325347
~~~~~~~~~~~~~~~~~~~~~~~~~
326348

0 commit comments

Comments
 (0)