oskarstark/env-var-extension

A Twig extension to access env variables

1.1.0 2020-11-18 12:54 UTC

This package is auto-updated.

Last update: 2020-12-27 10:29:47 UTC


README

This library provides methods to use environment variables in Twig templates.

CI

Installation

composer require oskarstark/env-var-extension
# config/services.yaml
services:
    OskarStark\Twig\EnvVarExtension:
        tags: ['twig.extension']

Usage

To access the value of an existing environment variable BRANCH_NAME=develop

{{ env(BRANCH_NAME) }} # prints 'develop'

You can also check if an envirnment variable exists:

{{ has_env(BRANCH_NAME) }} # prints 'true'