Reputation: 7597
I was wondering what is the best way to load yaml configuration files in symfony 2. I am talking about writing my own files and parse them to use them in my controllers.
Ideally I should be able to merge values from multiple config files representing the various environments I have in my app (dev, prod, ecc).
Let's say I have myconf.yml that looks like this:
name: x
surname: y
and myconf_dev.yml that looks like this:
surname: w
city: nyc
Ideally I would like some interface of this sort:
Magik::resolve("myconf", "dev");
which would return
name: x
surname: w
city: nyc
Sci-fi?
I spotted this http://symfony.com/doc/2.0/components/config/resources.html? Is it the right way to take? Or is there something better ready to use.
c i a o
Upvotes: 3
Views: 317
Reputation: 36231
Why inventing a new way if we have a good one already?
Symfony's service container can store configuration perfectly fine and you can import external resources with imports or container extensions.
Upvotes: 1