Skip to content

Commit d1bcc40

Browse files
committed
Remove mentions of XML in Getting started guides
XML is deprecated in 7.4. We should not advocate it anymore and people are on their own when they wish to still use it. For now, I suggest keeping the code examples (except from the Quick tour) to help in migration and developers inherting apps using XML.
1 parent 5fdca73 commit d1bcc40

File tree

5 files changed

+16
-65
lines changed

5 files changed

+16
-65
lines changed

configuration.rst

Lines changed: 7 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ Configuration Formats
5353
~~~~~~~~~~~~~~~~~~~~~
5454

5555
Unlike other frameworks, Symfony doesn't impose a specific format on you to
56-
configure your applications, but lets you choose between YAML, XML and PHP.
56+
configure your applications, but lets you choose between YAML and PHP.
5757
Throughout the Symfony documentation, all configuration examples will be
5858
shown in these three formats.
5959

@@ -66,20 +66,13 @@ readable. These are the main advantages and disadvantages of each format:
6666

6767
* **YAML**: simple, clean and readable, but not all IDEs support autocompletion
6868
and validation for it. :doc:`Learn the YAML syntax </reference/formats/yaml>`;
69-
* **XML**: autocompleted/validated by most IDEs and is parsed natively by PHP,
70-
but sometimes it generates configuration considered too verbose. `Learn the XML syntax`_;
7169
* **PHP**: very powerful and it allows you to create dynamic configuration with
7270
arrays or a :ref:`ConfigBuilder <config-config-builder>`.
7371

74-
.. note::
72+
.. deprecated:: 7.4
7573

76-
By default Symfony loads the configuration files defined in YAML and PHP
77-
formats. If you define configuration in XML format, update the
78-
:method:`Symfony\\Bundle\\FrameworkBundle\\Kernel\\MicroKernelTrait::configureContainer`
79-
and/or
80-
:method:`Symfony\\Bundle\\FrameworkBundle\\Kernel\\MicroKernelTrait::configureRoutes`
81-
methods in the ``src/Kernel.php`` file to add support for the ``.xml`` file
82-
extension.
74+
The XML format is deprecated in Symfony 7.4 and will be removed in
75+
Symfony 8.0.
8376

8477
Importing Configuration Files
8578
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -100,9 +93,9 @@ configuration files, even if they use a different format:
10093
- { resource: '/etc/myapp/*.yaml' }
10194
10295
# ignore_errors: not_found silently discards errors if the loaded file doesn't exist
103-
- { resource: 'my_config_file.xml', ignore_errors: not_found }
96+
- { resource: 'my_config_file.php', ignore_errors: not_found }
10497
# ignore_errors: true silently discards all errors (including invalid code and not found)
105-
- { resource: 'my_other_config_file.xml', ignore_errors: true }
98+
- { resource: 'my_other_config_file.php', ignore_errors: true }
10699
107100
# ...
108101
@@ -267,27 +260,6 @@ reusable configuration value. By convention, parameters are defined under the
267260
268261
// ...
269262
270-
.. warning::
271-
272-
By default and when using XML configuration, the values between ``<parameter>``
273-
tags are not trimmed. This means that the value of the following parameter will be
274-
``'\n [email protected]\n'``:
275-
276-
.. code-block:: xml
277-
278-
<parameter key="app.admin_email">
279-
280-
</parameter>
281-
282-
If you want to trim the value of your parameter, use the ``trim`` attribute.
283-
When using it, the value of the following parameter will be ``[email protected]``:
284-
285-
.. code-block:: xml
286-
287-
<parameter key="app.admin_email" trim="true">
288-
289-
</parameter>
290-
291263
Once defined, you can reference this parameter value from any other
292264
configuration file using a special syntax: wrap the parameter name in two ``%``
293265
(e.g. ``%app.admin_email%``):
@@ -331,7 +303,7 @@ configuration file using a special syntax: wrap the parameter name in two ``%``
331303
'email_address' => param('app.admin_email'),
332304
333305
// ... but if you prefer it, you can also pass the name as a string
334-
// surrounded by two % (same as in YAML and XML formats) and Symfony will
306+
// surrounded by two % (same as in the YAML format) and Symfony will
335307
// replace it by that parameter value
336308
'email_address' => '%app.admin_email%',
337309
]);
@@ -1369,7 +1341,6 @@ And all the other topics related to configuration:
13691341

13701342
configuration/*
13711343

1372-
.. _`Learn the XML syntax`: https://en.wikipedia.org/wiki/XML
13731344
.. _`environment variables`: https://en.wikipedia.org/wiki/Environment_variable
13741345
.. _`symbolic links`: https://en.wikipedia.org/wiki/Symbolic_link
13751346
.. _`utilities to manage env vars`: https://symfony.com/doc/current/cloud/env.html

page_creation.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ try it out by going to: http://localhost:8000/lucky/number
8787

8888
Symfony recommends defining routes as attributes to have the controller code
8989
and its route configuration at the same location. However, if you prefer, you can
90-
:doc:`define routes in separate files </routing>` using YAML, XML and PHP formats.
90+
:doc:`define routes in separate files </routing>` using the YAML or PHP formats.
9191

9292
If you see a lucky number being printed back to you, congratulations! But before
9393
you run off to play the lottery, check out how this works. Remember the two steps

quick_tour/the_architecture.rst

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -243,29 +243,6 @@ using the special ``when@`` keyword:
243243
router:
244244
strict_requirements: null
245245
246-
.. code-block:: xml
247-
248-
<!-- config/packages/framework.xml -->
249-
<?xml version="1.0" encoding="UTF-8" ?>
250-
<container xmlns="http://symfony.com/schema/dic/services"
251-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
252-
xmlns:framework="http://symfony.com/schema/dic/symfony"
253-
xsi:schemaLocation="http://symfony.com/schema/dic/services
254-
https://symfony.com/schema/dic/services/services-1.0.xsd
255-
http://symfony.com/schema/dic/symfony
256-
https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
257-
258-
<framework:config>
259-
<framework:router utf8="true"/>
260-
</framework:config>
261-
262-
<when env="prod">
263-
<framework:config>
264-
<framework:router strict-requirements="null"/>
265-
</framework:config>
266-
</when>
267-
</container>
268-
269246
.. code-block:: php
270247
271248
// config/packages/framework.php

routing.rst

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,16 @@ provides other useful features, like generating SEO-friendly URLs (e.g.
1212
Creating Routes
1313
---------------
1414

15-
Routes can be configured in YAML, XML, PHP or using attributes.
16-
All formats provide the same features and performance, so choose
17-
your favorite.
15+
Routes can be configured in YAML, PHP or using attributes. All formats
16+
provide the same features and performance, so choose your favorite.
1817
:ref:`Symfony recommends attributes <best-practice-controller-attributes>`
1918
because it's convenient to put the route and controller in the same place.
2019

20+
.. deprecated:: 7.4
21+
22+
The XML format to configure routes is deprecated in Symfony 7.4 and
23+
will be removed in Symfony 8.0.
24+
2125
.. _routing-route-attributes:
2226

2327
Creating Routes as Attributes

service_container.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -704,8 +704,7 @@ all their types (string, boolean, array, binary and PHP constant parameters).
704704

705705
However, there is another type of parameter related to services. In YAML config,
706706
any string which starts with ``@`` is considered as the ID of a service, instead
707-
of a regular string. In XML config, use the ``type="service"`` type for the
708-
parameter and in PHP config use the ``service()`` function:
707+
of a regular string. In PHP config use the ``service()`` function:
709708

710709
.. configuration-block::
711710

0 commit comments

Comments
 (0)