Ask your Symfony questions! Pay money and get answers fast! (more info)

How to get app.yml information from a different application Symfony


If I'm working in application 'mod1' and I need to get info that is stored in the app.yml file of application 'mod3', then how do I get it?

Answers (1)


Russ Flynn answers:


The easiest way is to use sfYaml::load($filename) to load the contents of any yaml file into an array for use.

$configArray = sfYaml::load(sfConfig::get("sf_root_dir")."/apps/myapp/config/app.yml");

If you want to have generic information across multiple apps, you can also put an app.yml file in the top level config directory of your project - this works with the configuration cascade, so values here can be overridden at the application level app.yml file if necessary.

The second of these two is probably the "cleaner" approach - as the values you are accessing should probably be shared across the applications.