jmf / twig-time
Twig extension for handling date and time in Twig templates.
1.0.1
2026-05-31 00:32 UTC
Requires
- php: ^8.3
- twig/twig: ^3.0
Requires (Dev)
- nesbot/carbon: ^3
- overtrue/phplint: ^9
- phpstan/phpstan: ^2
- phpstan/phpstan-strict-rules: ^2
- phpunit/phpunit: ^12|^13
- rector/rector: ^2
- squizlabs/php_codesniffer: ^4
Suggests
- ext-intl: Required for localized date and time formatting.
README
Installation & Requirements
Install with Composer:
composer require jmf/twig-time
PHP intl extension is required if you need to use internationalized date formats.
Usage in Twig templates
microtime() function
Returns current microtime (timestamp with milli/microseconds)
{% set now = microtime() %}
intl_format() filter
Formats provided IntlCalendar / DateTime object with internationalization.
See https://unicode-org.github.io/icu/userguide/format_parse/datetime/#datetime-format-syntax for available formatting tokens.
{{ date|intl_format('cccc', 'fr_CA.UTF-8') }}