newism / symfony2-standard-template

2 stars 5 forks source link

Configuration: XML, Yaml or Annotations? #6

Closed leevigraham closed 10 years ago

leevigraham commented 10 years ago

Yaml:

XML:

Annotations:

Ping @ianbelcher @iainsaxon

ghost commented 10 years ago

My personal preference (at the moment) is yaml, but it does have it's shortcomings in comparison to xml. I do find xml harder to read but it 'feels' like the proper way to go.

Annotations are the thorn in the side. As you've said, many bundles only support annotations, but again I 'feel' getting away from them is the right thing. For a larger site, routing would be much harder using annotations and I'm predicting Nelmio\ApiDocBundle will be a little more difficult to keep up to date correctly using annotations.

leevigraham commented 10 years ago

So lets go with yml for everything except controller annotations for bundles:

What? Filename Notes
Config config.yml
Services services.yml
Routes routes.yml Routes should be split into files for each controller
Validation validation.yml http://stackoverflow.com/a/16759153/1982031
Doctrine Metadata SomeEntity.orm.yml http://symfony.com/doc/current/book/doctrine.html#add-mapping-information
HATEOS representations http://hateoas-php.org/#yaml
JMS Serialiser http://jmsyst.com/libs/serializer/master/reference/xml_reference
Controller Annotations for bundles
leevigraham commented 10 years ago

No objections means this is closed. Added to the wiki: https://github.com/newism/symfony2-standard-template/wiki/Annotations-vs-YAML-vs-XML