3

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

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

good one mate ;) this link symfony.com/doc/2.0/components/config/resources.html puzzled me a bit but, as you pointed out, going the service way is the way. Cheers for that

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.