@@ -24,12 +24,12 @@ because it's convenient to put the route and controller in the same place.
2424Creating Routes as Attributes or Annotations
2525~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2626
27- On PHP 8, you can use native attributes to configure routes right away. On
28- PHP 7, where attributes are not available, you can use annotations instead,
29- provided by the Doctrine Annotations library .
27+ PHP attributes and annotations allow to define routes next to the code of the
28+ :doc: ` controllers < /controller >` associated to those routes. Attributes are
29+ native in PHP 8 and higher versions, so you can use them right away .
3030
31- In case you want to use annotations instead of attributes, run this command
32- once in your application to enable them :
31+ In PHP 7 and earlier versions you can use annotations (via the Doctrine Annotations
32+ library), but first you'll need to install the following dependency in your project :
3333
3434.. code-block :: terminal
3535
@@ -41,10 +41,11 @@ once in your application to enable them:
4141 Symfony 5.2. Prior to this, Doctrine Annotations were the only way to
4242 annotate controller actions with routing configuration.
4343
44- If you are using :ref: `Symfony Flex <symfony-flex >` this command also
45- creates the following configuration file and you're done. If you aren't
46- using flex or want to use attributes, the file has to be added manually.
47- ``type: annotation `` applies for attributes, too.
44+ Regardless of what you use (attributes or annotations) you need to add a bit of
45+ configuration to your project before using them. If you installed the annotations
46+ dependency and your project uses :ref: `Symfony Flex <symfony-flex >`, this file
47+ is already created for you. Otherwise, create the following file manually
48+ (the ``type: annotation `` option also applies to attributes, so you can keep it):
4849
4950.. code-block :: yaml
5051
0 commit comments