twig for key code example Example: twig for loop key {% for key, user in users %} <li>{{ key }}: {{ user.username|e }}</li> {% endfor %}