The DMSTwigExtensionBundle

  • PHP
  • November 30, 2012

When I started using Symfony one of the aspects that really caught my eye was Twig, it really got me back into using a template engine and I don’t think i can ever go back to mixing my HTML and PHP again.

Twig’s extensibility is also something truly awesome and powerful when developing for Symfony, it allows me to easily whip up an extension that get information from the right place in the right way without having to pollute the controller with excessive interactions, or quickly provide a filter to hammer data into the format I need it to be in.

So I created the DMSTwigExtensionBundle to do two things: hold my custom extensions that I use in various projects and enable other extensions, like the non-core extensions written by Fabien Potencier.

Fabien distributes a few extensions which he deemed should not be in core, but are very useful, these are in his own repository and they do thinks like: truncate text, wordwrap, localized date formatting, amongst other things.

I usually have these enabled in my projects, but that means that every time I need to add the composer dependency and then pick one of my bundles to add the service calls with the “twig.extension” tag, which is a pain and out of place. With this bundle I can just drop it in and it will create all of those for me and even give me the option of turning them on or off via configuration, all in one single place.

As time goes i’ll be adding more useful extensions, either that I find or create myself, hopefully making it easy for you to just drop it into your project and start using them, but leaving it flexible enough that you can easily switch them on or off individually.

So check out the Repository at: https://github.com/rdohms/DMSTwigExtensionBundle Remember to open issues at the main DMS repository: https://github.com/rdohms/DMS

If you want to use it, just drop it into your composer file, more instructions in the README.

 { "require": { "dms/twig-extension-bundle": "1.\*" } } 
comments powered by Disqus

Related Posts

2007 e Férias!

2007 e Férias!

  • December 30, 2006

2006 esta no final, 2007 esta vindo. Muitos blogs fizeram previsões e refletiram sobre o ano que passou, mas eu não vou entrar muito nisso.

Read More
Seven Things you might not know about me

Seven Things you might not know about me

  • January 4, 2009

Cool, I think this is my first English meme/tag, so let’s go.

Read More
Buscando Águias

Buscando Águias

  • August 21, 2006

Nesta Sexta-feira finalizei minha semana com um pouco de “iluminação”, participei de um Seminário extremamente interessante chamado “Buscando Águias” formulado por John Maxwell e apresentada por John Vereecken. Presidente da empresa Lidere a missão de Vereecken é promover a cultura de liderança na America latina, e é exatamente sobre este assunto que o seminário tratou. E seguindo a recomendação de John ao final da palestra, irei “espalhar o conhecimento e buscar águias”, por isso vou tenta relatar um pouco mais sobre como foi esta palestra.

Read More