artur-gajewski / date-converter-bundle
This bundle adds a Twig Extension with a filter for automatically dates to more readable format, such as 'today', 'yesterday', '5 minutes ago', '2 days ago', etc...
Installs: 961
Dependents: 1
Suggesters: 0
Security: 0
Stars: 3
Watchers: 1
Forks: 1
Open Issues: 0
Type:symfony-bundle
Requires
- php: >=5.3.2
- symfony/framework-bundle: >=2.0,<2.6-dev
- twig/twig: >=1.0,<2.0-dev
This package is not auto-updated.
Last update: 2024-11-18 15:20:32 UTC
README
About
This bundle adds a Twig Extension with a filter for automatically converting date to more human readable format:
- Yesterday
- 5 minutes ago
- 2 hours ago
- 3 days ago
and many more formats...
Travis CI status
Installation
Add the following lines to your composer.json file and update your project's composer installation.
{ "require": { "artur-gajewski/date-converter-bundle": "1.0.*@dev" } }
Add this bundle to your application's kernel:
// application/ApplicationKernel.php
public function registerBundles()
{
return array(
// ...
new Aga\DateConverterBundle\DateConverterBundle(),
// ...
);
}
Make the Twig extensions available by updating your services configuration
// app/config/services.yml
aga_dateconverter.twig.extension:
class: Aga\DateConverterBundle\Extension\DateConverterTwigExtension
tags:
- { name: twig.extension }
Usage
This library adds a filter for twig templates that can be used like so:
{{ item.created | ago }}
License
See LICENSE
.
Contact
Email: info@arturgajewski.com
Skype: artur.t.gajewski.com