All Projects → eschmar → time-ago-bundle

eschmar / time-ago-bundle

Licence: MIT License
Provides a simple twig filter for expressing time difference in words.

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to time-ago-bundle

breadcrumb-bundle
Symfony bundle for easy breadcrumbs management
Stars: ✭ 26 (+100%)
Mutual labels:  twig, twig-extension, symfony-bundle
Twig Extra Bundle
The Twig bundle for official extra extensions
Stars: ✭ 389 (+2892.31%)
Mutual labels:  twig, twig-extension, symfony-bundle
Fmbbcodebundle
🔠 BBCode bundle for Symfony projects
Stars: ✭ 56 (+330.77%)
Mutual labels:  twig, twig-extension, symfony-bundle
Reactrenderer
Client and Server-side React rendering from PHP
Stars: ✭ 201 (+1446.15%)
Mutual labels:  twig, twig-extension
User Bundle
A new Symfony user bundle
Stars: ✭ 116 (+792.31%)
Mutual labels:  twig, symfony-bundle
Twig Bundle
The Twig Bundle provides configuration for using Twig in your applications.
Stars: ✭ 2,150 (+16438.46%)
Mutual labels:  twig, symfony-bundle
Twig Deferred Extension
An extension for Twig that allows to defer block rendering.
Stars: ✭ 97 (+646.15%)
Mutual labels:  twig, twig-extension
Slugify
Converts a string to a slug. Includes integrations for Symfony, Silex, Laravel, Zend Framework 2, Twig, Nette and Latte.
Stars: ✭ 2,697 (+20646.15%)
Mutual labels:  twig, twig-extension
Auditor Bundle
Doctrine audits logs made easy.
Stars: ✭ 221 (+1600%)
Mutual labels:  twig, symfony-bundle
cssinliner-extension
[DEPRECATED] CSS inliner support for Twig
Stars: ✭ 30 (+130.77%)
Mutual labels:  twig, twig-extension
PhpStorm-Live-Templates-Craft-CMS
PhpStorm Live Templates for Craft CMS
Stars: ✭ 34 (+161.54%)
Mutual labels:  twig, twig-extension
Twig Extensions
Twig extensions
Stars: ✭ 1,469 (+11200%)
Mutual labels:  twig, twig-extension
Knppaginatorbundle
SEO friendly Symfony paginator to sort and paginate
Stars: ✭ 1,534 (+11700%)
Mutual labels:  twig, symfony-bundle
Msgphp
Reusable domain layers. Shipped with industry standard infrastructure.
Stars: ✭ 182 (+1300%)
Mutual labels:  twig, symfony-bundle
Markdown Extension
[DEPRECATED] Markdown support for Twig
Stars: ✭ 105 (+707.69%)
Mutual labels:  twig, twig-extension
markdown-extra
Markdown extension for Twig
Stars: ✭ 83 (+538.46%)
Mutual labels:  twig, twig-extension
twig-translation
A Twig Translation Extension
Stars: ✭ 15 (+15.38%)
Mutual labels:  twig, twig-extension
joomla-twig
Twig 2.0 & Twig extensions integration for Joomla! https://phproberto.github.io/joomla-twig/
Stars: ✭ 25 (+92.31%)
Mutual labels:  twig, twig-extension
String Extra
Unicode/String support for Twig
Stars: ✭ 92 (+607.69%)
Mutual labels:  twig, twig-extension
Cssinliner Extra
CSS Inliner support for Twig
Stars: ✭ 93 (+615.38%)
Mutual labels:  twig, twig-extension

TimeAgoBundle

Provides a simple twig filter for expressing time difference in words for Symfony. Uses a range of +-7 days, after that, the actual date is returned.

Install

Composer (Packagist):

composer require eschmar/time-ago-bundle ^v2.0.0 # Symfony ^5.0

or for older symfony versions:

composer require eschmar/time-ago-bundle ^v1.1.0 # Symfony ^4.x
composer require eschmar/time-ago-bundle ~v0.4.0 # Symfony ^2.8
composer require eschmar/time-ago-bundle ~v0.5.0 # Symfony ^3.4

app/Appkernel.php (Symfony <4):

new Eschmar\TimeAgoBundle\EschmarTimeAgoBundle(),

Usage

{{ date('now')|ago }}
{# just now #}

{{ date('now').modify('-3 minutes')|ago }}
{# 3 minutes ago #}

{{ date('now').modify('-3 months')|ago('r') }}
{# actual date in 'r' format #}

{{ date('now').modify('+4 hours')|ago('r') }}
{# in 4 hours #}

Change default format in config.yml:

eschmar_time_ago:
    format: 'Y-m-d H:i:s'

Translations available

  • Belarusian
  • Croatian
  • Czech
  • Danish
  • Dutch
  • English
  • French
  • Finnish
  • German
  • Hindi
  • Hungarian
  • Indonesian
  • Italian
  • Malay
  • Norwegian
  • Polish
  • Portuguese (Brazil)
  • Romanian
  • Russian
  • Slovenian
  • Spanish
  • Swedish
  • Tagalog
  • Turkish
  • Ukranian
  • Vietnamese

License

MIT License

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].