====== Configuring Symfony (and Environments) ====== The main configuration file lives in the app/config/ as a YAML, XML, (and/?) or PHP file. Only YAML is considered here. imports: - { resource: parameters.yml } - { resource: security.yml } framework: secret: "%secret%" router: { resource: "%kernel.root_dir%/config/routing.yml" } # ... # Twig Configuration twig: debug: "%kernel.debug%" strict_variables: "%kernel.debug%" # ... ===== Default Configuration Dump ===== Dump the default configuration for a bundle in YAML to the console: $ app/console config:dump-reference FrameworkBundle # using Bundle name $ app/console config:dump-reference framework # using configuration key ===== Environments ===== Different environments share the same PHP code (apart from the front controller), but use different configuration. A Symfony project generally begins with three environments: ''dev'', ''test'', and ''prod''. * Access ''dev'': http://localhost/app_dev.php/random/10 * Access ''prod'': http://localhost/app.php/random/10 * The ''test'' environment is used when running automated tests and cannot be accessed directly through the browser. See the [[http://symfony.com/doc/current/book/testing.html|testing chapter]]. To clear ''prod'' cache, rebuid stuff, etc.: $ php app/console cache:clear --env=prod --no-debug ==== Additional Environments ==== To create a new environment, copy ''web/app.php'' (or ''web/app_dev.php''?) to a new file and in that file associate the AppKernel with a new environment name in the ''AppKernel'' ctor; $kernel = new AppKernel('newname', false); Then create a config file that matches the environment name but prefixed with ''config_'': imports: - { resource: config.yml } framework: router: { resource: "%kernel.root_dir%/config/routing_dev.yml" } profiler: { only_exceptions: false } # ...