Skip to content
Easy language variable management for Kirby 3.
PHP
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
tests
.editorconfig
.gitattributes
.gitignore
LICENSE
README.md
composer.json
composer.lock
index.php
phpunit.xml

README.md

kirby-variables

Allows you to easily manage language variables by putting them in separate YAML files and nesting them.

Installation

With Composer:

composer require oblik/kirby-variables

Usage

After you've installed the plugin and you open your site, the plugin will run and it will automatically get the variables from your PHP files and put them in YAML files in the same directory. After that, you can remove the variables from your PHP files, as they're no longer needed. Then, use the YAML files to manage your variables.

Your variables should continue to work as they did so far. In the YAML file, nested arrays are flattened and their keys are concatenated with a period (.). For example, the following:

foo:
  bar: test
  baz:
    qux: test2

...is converted to:

Array
(
    [foo.bar] => test
    [foo.baz.qux] => test2
)

...and you can use the variables in your templates with t('foo.baz.qux').

You can’t perform that action at this time.