DMS Twig Extension Bundle, leverages Fabien Potencier's extra twig extensions for your website.

Installs: 278 416

Dependents: 2

Suggesters: 0

Security: 0

Stars: 19

Watchers: 4

Forks: 8

Open Issues: 2


v2.1.0 2017-08-18 22:24 UTC

This package is auto-updated.

Last update: 2024-02-18 04:51:24 UTC


This bundle leverages a collection of Fabien Potencier's Twig Extensions for use in your application.


Fabien's "Twig Extensions"

Available at Fabien's repository these extensions are considered useful but do not belong in the Core of Twig, so they have been moved to this separate repository, they are:

  • Text: truncate and wordwrap filter
  • Debug: retrieves the token parser
  • Intl: localized date filter
  • i18n: trans filter and block (this extension conflicts with standard Symfony translator, so it is off by default, see Usage below.)

Further documentation is available in the repository.

DMS Extensions

These are custom extensions which I find myself writing over and over for new projects.

  • Textual Date: converts timestamp into dates like: 2 days ago (docs)


Simply run this

composer require dms/twig-extension-bundle

Load the bundle in your AppKernel

// app/AppKernel.php

public function registerBundles()
    $bundles = array(
        // ...
        new DMS\Bundle\TwigExtensionBundle\DMSTwigExtensionBundle(),


To control which extensions should be enabled, you can optionally add configuration settings in app/config.yml:

# Default settings
        array: true
        date: true
        i18n: false
        intl: true
        text: true
        textual_date: true
        pad_string: true

Extensions set to false will not be loaded. Please refer to the extensions documentation for detailed usage on each one.