Symfony directory’ variables


For the times you’ll need access to some of Symfony’s directories:

Symfony dir
    [php]
    // root directory structure
    'sf_cache_dir_name'   => 'cache',
    'sf_log_dir_name'     => 'log',
    'sf_lib_dir_name'     => 'lib',
    'sf_model_dir_name'   => 'model',
    'sf_web_dir_name'     => 'web',
    'sf_data_dir_name'    => 'data',
    'sf_config_dir_name'  => 'config',
    'sf_apps_dir_name'    => 'apps',

    // global directory structure
    'sf_app_dir'        => $sf_root_dir.DIRECTORY_SEPARATOR.'apps'.DIRECTORY_SEPARATOR.$sf_app,
    'sf_model_dir'      => $sf_root_dir.DIRECTORY_SEPARATOR.'model',
    'sf_lib_dir'        => $sf_root_dir.DIRECTORY_SEPARATOR.'lib',
    'sf_web_dir'        => $sf_root_dir.DIRECTORY_SEPARATOR.'web',
    'sf_upload_dir'     => $sf_root_dir.DIRECTORY_SEPARATOR.'web'.DIRECTORY_SEPARATOR.'uploads',
    'sf_base_cache_dir' => $sf_root_dir.DIRECTORY_SEPARATOR.'cache'.DIRECTORY_SEPARATOR.$sf_app,
    'sf_cache_dir'      => $sf_root_dir.DIRECTORY_SEPARATOR.'cache'.DIRECTORY_SEPARATOR.$sf_app.DIRECTORY_SEPARATOR.$sf_environment,
    'sf_log_dir'        => $sf_root_dir.DIRECTORY_SEPARATOR.'log',
    'sf_data_dir'       => $sf_root_dir.DIRECTORY_SEPARATOR.'data',
    'sf_config_dir'     => $sf_root_dir.DIRECTORY_SEPARATOR.'config',

Easy access to those folder is provided with:

sfConfig::get('sf_cache_dir_name');

(Updated for Symfony 1.2)