How to make a twig extension in symfony2

Twig is a the flexible, fast, and secure PHP template engine.

I started  using twig since i found this in symfony2.

I was trying to use split function of php in twig but i was not able to split a text.
So i started to implement twig filter. In this tutorial I’m going to make a simple Twig extension.
First we have to write a twig extension.
Step 1: Create a Extension Folder in the Bundle
Step 2: Create a php file in Extension Folder called MyTwigExtension.php

Continue reading