Cover of the book Symfony 5: The Fast Track

Symfony 5: The Fast Track is the best book to learn modern Symfony development, from zero to production. +300 pages showcasing Symfony with Docker, APIs, queues & async tasks, Webpack, SPAs, etc.

WARNING: You are browsing the documentation for Symfony 4.1 which is not maintained anymore. Consider upgrading your projects to Symfony 5.1.

How to Check the Syntax of Your Twig Templates

4.1 version
Maintained Unmaintained

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 bin/console lint:twig templates/article/recent_list.html.twig

# or by directory:
$ php bin/console lint:twig templates/

This work, including the code samples, is licensed under a Creative Commons BY-SA 3.0 license.