Skip to content

Latest commit

 

History

History
23 lines (19 loc) · 435 Bytes

README.md

File metadata and controls

23 lines (19 loc) · 435 Bytes

twig-age-extension

Simple Twig extension to calculate the age in years based on a DateTime instance

Installation

Install via composer:

composer require guzzlefry/twig-age-extension:@dev

Add the following to your services.yml file:

services:
    twig.extension.date:
        class: Guzzlefry\Twig\AgeExtension
        tags:
            - { name: twig.extension }

Usage

{{ user.birthdate | age }}