Wouter De Jong
Contributed by Wouter De Jong in #8635

Did you know that Symfony comes with a command that outputs the default configuration for a bundle extension?

1
$ ./app/console config:dump-reference twig

The output also contains documentation when provided by the extension:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
twig:
    exception_controller:  twig.controller.exception:showAction
    form:
        resources:

            # Default:
            - form_div_layout.html.twig

            # Example:
            - MyBundle::form.html.twig
    globals:

        # Examples:
        foo:                 "@bar"
        pi:                  3.14

        # Prototype
        key:
            id:                   ~
            type:                 ~
            value:                ~
    autoescape:           ~
    autoescape_service:   ~
    autoescape_service_method:  ~
    base_template_class:  ~ # Example: Twig_Template
    cache:                '%kernel.cache_dir%/twig'
    charset:              '%kernel.charset%'
    debug:                '%kernel.debug%'
    strict_variables:     ~
    auto_reload:          ~
    optimizations:        ~
    paths:                []

This feature is not new, but as of 2.4, you can choose between the YAML and the XML format:

1
$ ./app/console config:dump-reference twig --format=xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<!-- Default configuration for extension with alias: "twig" -->
<!-- Namespace: http://example.org/schema/dic/twig -->
<!-- base-template-class: Example: Twig_Template -->
<config
    exception-controller="twig.controller.exception:showAction"
    autoescape=""
    autoescape-service="null"
    autoescape-service-method="null"
    base-template-class=""
    cache="%kernel.cache_dir%/twig"
    charset="%kernel.charset%"
    debug="%kernel.debug%"
    strict-variables=""
    auto-reload=""
    optimizations=""
>

    <form>

        <!-- prototype -->
        <resource>form_div_layout.html.twig</resource>

    </form>

    <!-- prototype -->
    <global
        key="global key"
        id=""
        type=""
        value=""
    />

    <!-- prototype -->
    <path>value</path>

</config>
Published in #Living on the edge