Symfony2: Human Readable Configuration

When integrating bundles from other repositories into our project we would like to have an easy way to get a defacto configuration of the bundle at hand. We could either go jump on github and try to guess the configuration from the `Configuration.php` file within the bundle, but why bother since we have the great and new command `php app/console config:dump-reference NameOfBundle` this can be invoked to display the yml version of a sample default configuration for that given bundle.

By looking at the result of the command we can find out about the available settings in a more human readable fashion. Besides the typical default and mandatory configuration flags there is new information set through methods like *setExample* and *setInfo* which will enrich our `Configuration.php` bundle configuration file used like in the example below:

->scalarNode('access_denied_url')->defaultNull()->setExample('/foo/error403')->end()
->scalarNode('session_fixation_strategy')->cannotBeEmpty()->setInfo('strategy can be: none, migrate, invalidate')->defaultValue('migrate')->end()

If you don’t know what argument to pass or are just exploring you can easily call `php app/console container:debug` to get their service names with which to call the `config:dump-reference` command. Providing human readable default configurations for the users of our bundle will boost its quick usage and adoption.

Gist Tools For Quick Snippets

I recently ran into a nice gist cli tool setup shown here and you can easily jump into its usage from ubuntu box doing:

$ sudo gem install gist
$ git config --global github.user "your-github-username"
$ git config --global github.token "your-github-token"
$ gist - ... // Ctrl+D to finish string


It is so cool, now there is just one thing to look perhaps to a widget on chrome or something.