Download the PHP package bnomei/kirby3-dotenv without Composer
On this page you can find all versions of the php package bnomei/kirby3-dotenv. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download bnomei/kirby3-dotenv
More information about bnomei/kirby3-dotenv
Files in bnomei/kirby3-dotenv
Package kirby3-dotenv
Short Description Kirby 3 Plugin for environment variables from .env
License MIT
Informations about the package kirby3-dotenv
Kirby 3 DotEnv
Kirby 3 Plugin for environment variables from .env
Commercial Usage
Support open source!
This plugin is free but if you use it in a commercial project please consider to sponsor me or make a donation.
If my work helped you to make some cash it seems fair to me that I might get a little reward as well, right?
Be kind. Share a little. Thanks.
‐ Bruno
M | O | N | E | Y |
---|---|---|---|---|
Github sponsor | Patreon | Buy Me a Coffee | Paypal dontation | Hire me |
Similar Plugins
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
orcomposer require bnomei/kirby3-dotenv
Setup
.env file Examples
/.env
/.env.staging
Usage everywhere but in Config files
⚠️ ATTENTION: The global PHP functions
getenv()
orputenv()
are NOT supported by this plugin since v2. What will work...
- use super globals
$_ENV[]
,$_SERVER[]
or- the plugins global helper function
env()
or->getenv()
,->env()
page and site methods
on server
on staging server
Usage in Config files
See config examples on how to use this plugin in combination with kirbys config files. Since v2 this plugin support Kirbys Multi-environment setup used to merging multiple config files.
Default values
In case you want to provide a default value as fallback in case the environment variable is not set you can do that with the 2nd parameter in each helper function.
Thanks for your PR @teichsta
Settings
bnomei.dotenv. | Default | Description |
---|---|---|
dir | callback |
returning kirby()->roots()->index(). When installing Kirby 3 with Composer use a function() { return realpath(kirby()->roots()->index() . '/../'); } |
file | .env |
|
required | [] |
You can define required variables in the Settings using an array. If any of these is missing a RuntimeException will be thrown. |
setup | callback |
perform additional tasks on raw dotenv class instance |
Dependencies
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
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