This is a Twig extension for Symfony Framework where you can easily convert a datetime/timestamp to a clock icon.
Example, if post.created
is "17/10/19 07:23:29"
{{ post.created|dt2clock }}
Will output: ๐ข
composer require linnit/dt2icon
or update your composer.json
"require": {
"linnit/dt2icon": "1.*"
}
Add the extension to Symfony
# app/config/services.yml
linnit.twig.dt2icon:
class: Linnit\Twig\Extension\DT2IconExtension
tags: ['twig.extension']
{{ post.created|dt2clock }}
To test, just run phpunit
./vendor/phpunit/phpunit/phpunit