Erik
Erik

Reputation: 3636

Is there a way to see an application's configuration in Symfony2?

Symfony2 Applications have their configuration stored in different files throughout the application, in different packages. You can even overwrite values in lower packages.

This can often get confusing as you need to know what a configuration setting is, but do not know where to look or cannot quickly find it.

It gets even worse when you find the setting, only to realise later that that setting isn't actually used because it's overwritten somewhere else.

Is there a command, plugin, or anything that lets you see all the configuration in a single location, the way it is actually used by Symfony2?

Upvotes: 0

Views: 106

Answers (2)

Damien
Damien

Reputation: 5882

There is nothing you can do to get a complete picture of the whole application at runtime, but you can catch parts of it.

First thing to do is explore the profiler:

sfDebug

You will have access to the Request, the logs, the routing...

What you can do next, if this is not enougth, is dumping the container.

dump($this->container);

From a Controller i.e. This will contains all the parameters, all the service definitions and so on.

Upvotes: 1

qooplmao
qooplmao

Reputation: 17759

You can get the current configuration for a bundle using the debug:config (with the alias config:debug) command. From what I can see the debug:config command appeared in 2.5 although the config:debug may have been around a long time before.

For example, to get the config for the FOSUserBundle your would use

app/console debug:config fos_user

Upvotes: 1

Related Questions