Skip to content
Kirby 3 Plugin for environment variables from .env
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.
classes
vendor
.editorconfig
.gitignore
.php_cs.dist
README.md
composer.json
composer.lock
index.php

README.md

Kirby 3 DotEnv

GitHub release License Kirby Version Kirby 3 Pluginkit

Kirby 3 Plugin for environment variables from .env using vlucas/phpdotenv.

Commercial Usage

This plugin is free but if you use it in a commercial project please consider to

Installation

  • unzip master.zip as folder site/plugins/kirby3-dotenv or
  • git submodule add https://github.com/bnomei/kirby3-dotenv.git site/plugins/kirby3-dotenv or
  • composer require bnomei/kirby3-dotenv

Setup

.env file

APP_MODE=production
APP_DEBUG=true
ALGOLIA_APIKEY=12d7331a21d8a28b3069c49830f463e833e30f6d
KIRBY_API_USER=bnomei
KIRBY_API_PW=52d3a0edcc78be6c5645fdb7568f94d3d83d1c2a

plugin helper methods

echo env('APP_MODE'); // production
// or
echo $page->getenv('ALGOLIA_APIKEY'); // 12d7331a21d8a28b3069c49830f463e833e30f6d

plain php

Bnomei\Dotenv::load();
echo getenv('APP_DEBUG'); // true

Settings

All settings need to be prefixed with bnomei.dotenv..

dir

  • default: a callback returning kirby()->roots()->index()

TIP: when installing Kirby 3 with Composer use a function() { return realpath(kirby()->roots()->index() . '/../'); }

filename

  • default: .env

required

  • default: []

Disclaimer

This plugin is provided "as is" with no guarantee. Use it at your own risk and always test it yourself before using it in a production environment. If you find any issues, please create a new issue.

License

MIT

It is discouraged to use this plugin in any project that promotes racism, sexism, homophobia, animal abuse, violence or any other form of hate speech.

Credits

based on K2 version of

You can’t perform that action at this time.