OskarStark / env-var-extension

Use environment variables in Twig templates.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

env-var-extension

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) }} # returns: true

About

Use environment variables in Twig templates.

License:MIT License


Languages

Language:PHP 92.0%Language:Makefile 8.0%