previewtechs/twig-essentials

Essential extensions, filters for Twig PHP template engine

v1.1 2018-08-06 13:19 UTC

This package is auto-updated.

Last update: 2024-12-06 09:30:21 UTC


README

Usage

Few useful extra functionality to work with your Twig template engine in your PHP application.

Installation

composer require previewtechs/twig-essentials:dev-master

Add TwigExtras extension to your Twig environment

<?php
$twig->addExtension(new \Previewtechs\TwigEssentials\Extensions\TwigExtras());

In your view file, start using extension and other features.

Extensions
  • date_tzconvert

    Convert date time to any timezone.

    {{ created | date_tzconvert }} will convert your date to your application's default timezone

    • Optional params. date_tzconvert($toTimezone, $fromTimezone, $format)