PHPackages                             zizther/craft-dynamic-variables - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Templating &amp; Views](/categories/templating)
4. /
5. zizther/craft-dynamic-variables

ActiveCraft-plugin[Templating &amp; Views](/categories/templating)

zizther/craft-dynamic-variables
===============================

Allows you to parse any text as a Twig template, with access to variables, from globals, entries, etc.

2.0.1(2y ago)0469MITPHPPHP ^8.0

Since Jul 9Pushed 2y ago1 watchersCompare

[ Source](https://github.com/zizther/craft-dynamic-variables)[ Packagist](https://packagist.org/packages/zizther/craft-dynamic-variables)[ RSS](/packages/zizther-craft-dynamic-variables/feed)WikiDiscussions master Synced yesterday

READMEChangelog (9)Dependencies (2)Versions (14)Used By (0)

Craft Dynamic Variables plugin for Craft CMS 4.x &amp; 5.x
==========================================================

[](#craft-dynamic-variables-plugin-for-craft-cms-4x--5x)

Allows you to parse any text as a Twig template, with access to variables, from globals, entries, etc.

For Craft 3 support check out the [v1 branch](https://github.com/zizther/craft-dynamic-variables/tree/v1).

Requirements
------------

[](#requirements)

This plugin requires Craft CMS 4.0.0+ or 5.0.0+.

Installation
------------

[](#installation)

To install the plugin, follow these instructions.

1. Open your terminal and go to your Craft project:

    ```
     cd /path/to/project

    ```
2. Then tell Composer to load the plugin:

    ```
     composer require zizther/craft-dynamic-variables

    ```
3. In the Control Panel, go to Settings → Plugins and click the “Install” button for Dynamic Variables.

Dynamic Variables Overview
--------------------------

[](#dynamic-variables-overview)

The filter and function allows you to output variables from Craft, globals, plugins and your configs. You would reference the field as you would in a template with `{{ }}`.

This plugin is limited to outputting text based fields, by default, however if you would like to reference the entry itself you can do this passing in the entry within the filter or function, You will be able to reference any field within the entry you pass in.

```
{% set entry = craft.entries({ id: 1 }).one() %}
{{ '{{ entry.title }}' | dv(entry) }}
{{ dv('{{ entry.title }}', entry) }}

```

Using Dynamic Variables
-----------------------

[](#using-dynamic-variables)

Here are some example for using the filter and function.

### Craft

[](#craft)

Want to output the site name or site URL.

#### Filter

[](#filter)

`{{ '{{ siteName }} {{ siteUrl }}' | dv }}`

#### Function

[](#function)

`{{ dv('{{ siteName }} {{ siteUrl }}') }}`

### Globals

[](#globals)

If you want to output a global field, such as a telephone number.

#### Filter

[](#filter-1)

`{{ '{{ globalHandle.fieldHandle }}' | dv }}`

#### Function

[](#function-1)

`{{ dv('{{ globalHandle.fieldHandle }}') }}`

### Plugin example

[](#plugin-example)

If you want to output field data from a plugin such as SEOmatic.

#### Filter

[](#filter-2)

`{{ '{{ seomatic.site.sameAsLinks["instagram"]["url"] }}' | dv }}`

#### Function

[](#function-2)

`{{ dv('{{ seomatic.site.sameAsLinks["instagram"]["url"] }}') }}`

### Config example

[](#config-example)

Maybe you want to output a value from a config file, such as a custom value in the general.php file.

#### Filter

[](#filter-3)

`{{ '{{ craft.app.config.general.custom.variableName }}' | dv }}`

#### Function

[](#function-3)

`{{ dv('{{ craft.app.config.general.custom.variableName }}') }}`

Brought to you by [Nathan Reed](https://vimia.co.uk)

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~124 days

Recently: every ~324 days

Total

12

Last Release

770d ago

Major Versions

1.0.6 → 2.0.02022-05-11

v1.x-dev → 2.0.12024-04-02

### Community

Maintainers

![](https://www.gravatar.com/avatar/3b2281e849491cfa21b4eab76c62308066129d001aa7bf23bba983baf3de5327?d=identicon)[zizther](/maintainers/zizther)

---

Top Contributors

[![zizther](https://avatars.githubusercontent.com/u/1436378?v=4)](https://github.com/zizther "zizther (26 commits)")

---

Tags

cmsCraftcraftcmscraft-plugindynamic variables

### Embed Badge

![Health badge](/badges/zizther-craft-dynamic-variables/health.svg)

```
[![Health](https://phpackages.com/badges/zizther-craft-dynamic-variables/health.svg)](https://phpackages.com/packages/zizther-craft-dynamic-variables)
```

###  Alternatives

[lewisjenkins/craft-dynamic-fields

Populate Craft fields with dynamic data using the power of Twig.

14667.0k](/packages/lewisjenkins-craft-dynamic-fields)[nystudio107/craft-minify

A simple plugin that allows you to minify blocks of HTML, CSS, and JS inline in Craft CMS templates.

37461.2k29](/packages/nystudio107-craft-minify)[jalendport/craft-preparse

A fieldtype that parses Twig when an element is saved and saves the result as plain text.

1086.4k](/packages/jalendport-craft-preparse)[craftpulse/craft-colour-swatches

Let clients choose from a predefined set of colours and utilise associated colour codes and class names in your templates.

3530.8k2](/packages/craftpulse-craft-colour-swatches)[verbb/footnotes

Adds a footnotes feature to CKEditor fields and Twig templates.

213.3k](/packages/verbb-footnotes)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
