Twig

The flexible, fast, and secure
template engine for PHP

a Symfony Product
Docs Filters capitalize
Docs for Twig version 1.x
Switch to another version: 2.x, 3.x
⚠️ Version 1.x is not maintained.

Questions & Feedback

License

Twig documentation is licensed under the new BSD license.

capitalize

The capitalize filter capitalizes a value. The first character will be uppercase, all others lowercase:

1
2
3
{{ 'my first car'|capitalize }}

{# outputs 'My first car' #}