Download the PHP package dms/twig-extension-bundle without Composer
On this page you can find all versions of the php package dms/twig-extension-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download dms/twig-extension-bundle
More information about dms/twig-extension-bundle
Files in dms/twig-extension-bundle
Package twig-extension-bundle
Short Description DMS Twig Extension Bundle, leverages Fabien Potencier's extra twig extensions for your website.
License MIT
Homepage https://github.com/rdohms/DMSTwigExtensionBundle
Informations about the package twig-extension-bundle
DMSTwigExtensionBundle
This bundle leverages a collection of Fabien Potencier's Twig Extensions for use in your application.
Extensions
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)
Installing
Simply run this
Load the bundle in your AppKernel
<?php
// app/AppKernel.php
public function registerBundles()
{
$bundles = array(
// ...
new DMS\Bundle\TwigExtensionBundle\DMSTwigExtensionBundle(),
);
}
Usage
To control which extensions should be enabled, you can optionally add configuration settings in app/config.yml:
# Default settings
dms_twig_extension:
fabpot:
array: true
date: true
i18n: false
intl: true
text: true
dms:
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.