You must first sign up to be able to contribute.

Version 5 (modified by florian.klein, 7 years ago)

How to manage your own cross-apps/global configuration values

If you want a global configuration file with a nice accessor preffix (ef. project_), you can use the sfDefineEnvironmentConfigHandler class and a specific param in a custom <project_root>/config/config_handlers.yml file, like this :

  class:    sfDefineEnvironmentConfigHandler
    prefix:  project_

You will now have to append these lines to the ./<appname>/config/<appname>Configuration.class.php of every app you want to be able to access config values from :

public function configure()
    require_once sfConfigCache::getInstance()->checkConfig('config/project.yml');

Below a sample config/project.yml file :

    value: It works !

You'll now be able to call these cross-apps config values like this :

echo sfConfig::get('project_section_value', 'It does not work'); // prints "It works !"

Alternatively, if you don't mind accessing these cross-application settings with the accessor prefix "app", you can place them in your project's config/app.yml (not the individual application app/config/app.yml file).