Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Annotations or yaml - Symfony3 [closed]

For routes that are best used In the good practices recommend https://librosweb.es/libro/buenas_practicas_symfony/capitulo_1.html

Which is better and why?

like image 267
juanitourquiza Avatar asked Nov 25 '16 17:11

juanitourquiza


1 Answers

From the Official Doc, in the chapter about Symfony Best Practices regarding controller suggest as best practice to use annotations:

Best Practice

Make your controller extend the FrameworkBundle base controller and use annotations to configure routing, caching and security whenever possible.

The main motivation about this is for readability and simplify the configuration:

In addition, using annotations for routing, caching and security simplifies configuration. You don't need to browse tens of files created with different formats (YAML, XML, PHP): all the configuration is just where you need it and it only uses one format.

No impact about performace (generally all this stuff will be cached and don't depends about the format you choice)

Hope this helps

like image 106
Matteo Avatar answered Nov 11 '22 10:11

Matteo