I agree that it makes things a little more fractured. It's certainly not my 
preference either. My two cents is that having multiple formats forces coders 
to learn all the formats just to be able to debug or learn the framework and 
third party bundles properly. But it's an issue that's been debated a few times 
on the dev mailing list and I think we're pretty much stuck with the way things 
are now. 

The best practice for bundles made for redistribution is to make the config XML 
because they can be validated against a schema/DTD which can pick up some 
non-obvious errors. Great for testing. You can also provide an XSD to validate 
your own config values - 
http://symfony.com/doc/current/cookbook/bundles/extension.html

If you're not writing a bundle for redistribution, you're quite welcome to 
write the config as YAML (it's what I do), and if you want to share a bundle 
later, I think you can convert a YAML config into an XML one using the Symfony 
Config component. It'd be nice if there was a simple command line task to 
handle the conversion for you, mind you. 

As Jordi points out, XLIFF files aren't really Symfony's fault - you can use 
YAML, arrays, or even a database as a translation backend if you like, but I 
can see why the Sensio guys went with a well-understood open standard format. 
There are lots of translation tools out there that understand XLIFF, which can 
be really useful for getting contributions from translators who aren't 
necessarily also coders. 

By the way, you missed .ini files: parameters.ini. Even though it's completely 
optional, it's part of the standard edition. :)

So I guess the short version is: yes, there are reasons that not all the config 
files are in the same format. IIRC, the PHP possibility is because that's how 
they end up in the cache. I wouldn't recommend it for normal usage, personally. 
A possible use-case might be for simple test cases, or using a component in a 
standalone context (outside of Symfony2). 

On 5 Jun 2011, at 10:44, keymaster wrote:

> Was wondering why the best practice recommendation for configuration file 
> formats changes throughout Symfony2 documentation.
> 
> For example,
> 
> 1. config/config.yml file - Yaml
> 2. bundle config files - XML
> 3. application config files - Yaml.
> 4. translation resources - XML (XLIFF).
> 
> Any particular reason? 
> Sure would have been nice to have a single standard used throughout.
> 
> Interestingly, I have never seen any reference to using php files for config, 
> yet they remain an option. 
> Do they have a recommended usecase?
> 
> -- 
> If you want to report a vulnerability issue on symfony, please send it to 
> security at symfony-project.com
>  
> You received this message because you are subscribed to the Google
> Groups "symfony users" group.
> To post to this group, send email to symfony-users@googlegroups.com
> To unsubscribe from this group, send email to
> symfony-users+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/symfony-users?hl=en

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to