WhiteProfileSpecialist
WhiteProfileSpecialist

Reputation: 119

How to switch from yaml to php config in symfony3?

In symfony 2.6 as i remember you could specify php config preference while installing symfony, but now it's yaml by default... There is also no entry in the symfony documentation about this matter.

Upvotes: 1

Views: 353

Answers (1)

qooplmao
qooplmao

Reputation: 17759

If you want to move everything to php you could set the configuration file to .php rather than .yml like

class AppKernel extends Kernel
{
    // ...

    public function registerContainerConfiguration(LoaderInterface $loader)
    {
        $loader->load($this->getRootDir().'/config/config_'.$this->getEnvironment().'.php');
    }
}

Alternatively, if you want to keep what you currently have and just use php for some of your configuration you could include it as an import like

# app/config/config.yml
imports:
    - { resource: 'parameters.yml' }
    - { resource: 'security.yml' }
    - { resource: 'your_config.php' }

Upvotes: 3

Related Questions