How to Check the Syntax of Your Twig Templates

Version: 2.7
Edit this page

Warning: You are browsing the documentation for Symfony 2.7, which is no longer maintained.

Read the updated version of this page for Symfony 5.3 (the current stable version).

How to Check the Syntax of Your Twig Templates

You can check for syntax errors in Twig templates using the lint:twig console command:

1
2
3
4
5
# You can check by filename:
$ php app/console lint:twig app/Resources/views/article/recent_list.html.twig

# or by directory:
$ php app/console lint:twig app/Resources/views
This work, including the code samples, is licensed under a Creative Commons BY-SA 3.0 license.