How to enable the Twig Text Extension in Symfony2

http://www.scott-sherwood.com/how-to-enable-the-twig-text-extension-in-symfony2/

The twig text extension has some very useful text filters. To enable it add the following to your config.yml

// app/config/config.yml
...
services:
 twig.extension.text:
     class: Twig_Extensions_Extension_Text
     tags:
         - { name: twig.extension }

This will enable some useful features like, truncate and word-wrap.

Truncate syntax

{{ <some string> | truncate(50) }}