Fork me on GitHub


Although configuration are text files, all values are not interpreted as strings. See below values that will be casted into their corresponding PHP type :

  • true, false
  • null
  • integers
  • floats (. as separator)


Rendering of these values could be not satisfying in some cases. See Formatters chapter for dealing with this issue.


A variable can also be a list of values. List are surrounded by square brackets and values must be separated by commas.

Examples :

    dev = [value1, value2, value3]
    staging = [1, null, true, false, 2]
    prod = [singleValue]


List can not be nested

While hydrating, a line which refers to a list variable will be duplicated for each value of the list.

Exemple 1 :

# system.yml-dist
    - <%servers%>
# system.yml
    - value1
    - value2
    - value3

Exemple 2 :

# system.ini-dist
servers[] = <%servers%>
# system.ini
servers[] = value1
servers[] = value2
servers[] = value3

Controlling list hydratation

While dealing with lists, if default hydratation policy doesn’t fit your needs, you can override it with karma:list directive.

<?php // system.php-dist

$serverList = array(<% karma:list var=servers delimiter=", " %>);
# system.ini-dist
serverList = <% karma:list var=servers delimiter="|" %>

This directive injects all the values inlined and separed by delimiter string (if provided).


The delimiter parameter is optional

Examples above will generate this files :

<?php // system.php

$serverList = array(value1, value2, value3);
# system.ini
serverList = value1|value2|value3

It’s also possible to define wrapping strings. These strings are inserted only if the list contains at least one value. The wrapper expects 2 values : the prefix and the suffix. The syntax is wrapper="<prefix>":"<suffix>".

# system.yml-dist
serverList: <% karma:list var=servers delimiter=", " wrapper="[":"]" %>

This example will generate this file :

# system.yml
serverList: [value1, value2, value3]

If the list is empty, the generated file will be :

# system.yml

If you need to generate wrapping strings even if the list is empty, you have to write it this way :

# system.yml-dist
serverList: {<% karma:list var=servers delimiter=", " %>}


The wrapper parameter is optional.


You must respect the parameter order : var, then delimiter, then wrapper.

var is always mandatory. You can use wrapper without defining delimiter.


Of course, the karma:list directive supports formatters