jasonroman / twig-extension-bundle
Jason Roman's Twig Extension Bundle for Symfony2
Installs: 3 698
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: >=5.3.0
This package is not auto-updated.
Last update: 2024-11-09 16:15:30 UTC
README
This is a class that contains Twig filters. There are 5 filters:
- phone - displays a phone number in a specified format
- price - essentially a PHP number_format() clone that adds '$' to the front
- boolean - returns 'Yes'/'No' (or custom text) based on the boolean value of the variable
- md5 - displays the md5 hash of the passed-in value
- timeAgo - converts a time to time 'ago', such as 5 days ago, 27 seconds ago, 2 years ago
Installation
Add the bundle to your composer.json
{ "require": { "jasonroman/twig-extension-bundle": "1.0.*@dev" } }
Register the bundle in app/AppKernel.php
$bundles = array( // ... new JasonRoman\Bundle\TwigExtensionBundle\JasonRomanTwigExtensionBundle(), );
Usage
{{ somePhone|phone }} {{ someCurrency|price }} {{ someValue|boolean }} {{ someString|md5 }} {{ someDate|timeAgo }}