marcaube / silex-skeleton

My starting point for Silex projects
MIT License
7 stars 1 forks source link

Using igorw/ConfigServiceProvider #1

Open h4cc opened 10 years ago

h4cc commented 10 years ago

How about using https://github.com/igorw/ConfigServiceProvider ?

marcaube commented 10 years ago

Could be neater than the current php configs. I got to say that I love yaml configs, and this could enable different file format depending on personal preference.

marcaube commented 10 years ago

Alright, so made a branch to test this out and I have a few questions as to what should go in there and how to organize those files.

The app/config/dev.php and app/config/prod.php files are a bit misleading in the sense that they not only contain configs but also register services depending on the current env. Most of this code could go in app/app.php.

What's left then to put in config files? The template paths? The debug flag?

Do we organize the configs like in Symfony : a general config.yml file that is imported by either config_dev.yml or config_prod.yml depending on the current env?

What do you think?

h4cc commented 10 years ago

There can not be any service definitions anymore in the config files. The content of these config files will be transferred to the $app as current parameters.

Also does igor mention to register the config-provider at latest, so the app parameters will not be overwritten: https://github.com/igorw/ConfigServiceProvider#register-order

I found another silex-skeleton, also using the config-provider: https://github.com/lppl/silex-skeleton/blob/master/src/app.php https://github.com/lppl/silex-skeleton/blob/master/config/config.php Looks quite good how it is handled there.