File tree Expand file tree Collapse file tree 8 files changed +40
-26
lines changed Expand file tree Collapse file tree 8 files changed +40
-26
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,11 @@ This plugin is free but if you use it in a commercial project please consider to
1616- [ buy me ☕] ( https://buymeacoff.ee/bnomei ) or
1717- [ buy a Kirby license using this affiliate link] ( https://a.paddle.com/v2/click/1129/35731?link=1170 )
1818
19+ ## Similar Plugins
20+
21+ - [ beebmx/kirby-env] ( https://github.com/beebmx/kirby-env )
22+ - [ johannschopplich/kirby-extended] ( https://github.com/johannschopplich/kirby-extended )
23+
1924## Installation
2025
2126- unzip [ master.zip] ( https://github.com/bnomei/kirby3-dotenv/archive/master.zip ) as folder ` site/plugins/kirby3-dotenv ` or
@@ -53,6 +58,7 @@ echo $_ENV['APP_MODE']; // production
5358echo env('APP_DEBUG'); // false
5459// or
5560echo $page->getenv('ALGOLIA_APIKEY'); // 12d7331a21d8a28b3069c49830f463e833e30f6d
61+ echo $page->env('ALGOLIA_APIKEY'); // 12d7331a21d8a28b3069c49830f463e833e30f6d
5662```
5763
5864** on staging server**
@@ -61,6 +67,7 @@ echo $_ENV['APP_MODE']; // staging
6167echo env('APP_DEBUG'); // true
6268// or
6369echo $page->getenv('ALGOLIA_APIKEY'); // 37e30ad867ff3a427317dcd1852abbd692b39ffc
70+ echo $page->env('ALGOLIA_APIKEY'); // 37e30ad867ff3a427317dcd1852abbd692b39ffc
6471```
6572
6673## Usage in Config files
Original file line number Diff line number Diff line change 11{
22 "name" : " bnomei/kirby3-dotenv" ,
33 "type" : " kirby-plugin" ,
4- "version" : " 2.0.0 " ,
4+ "version" : " 2.0.1 " ,
55 "description" : " Kirby 3 Plugin for environment variables from .env" ,
66 "license" : " MIT" ,
77 "authors" : [
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ require_once __DIR__ . '/classes/DotEnv.php ' ;
4+
5+ if (! function_exists ('loadenv ' )) {
6+ function loadenv (array $ options = [])
7+ {
8+ return \Bnomei \DotEnv::load ($ options );
9+ }
10+ }
11+
12+ if (! function_exists ('env ' )) {
13+ function env (string $ env )
14+ {
15+ return \Bnomei \DotEnv::getenv ($ env );
16+ }
17+ }
Original file line number Diff line number Diff line change 11<?php
22
33@include_once __DIR__ . '/vendor/autoload.php ' ;
4+ @include_once __DIR__ . '/global.php ' ;
45
56Kirby::plugin ('bnomei/dotenv ' , [
67 'options ' => [
1617 }
1718 ],
1819 'pageMethods ' => [
20+ 'env ' => function (string $ env ) {
21+ return \Bnomei \DotEnv::getenv ($ env );
22+ },
1923 'getenv ' => function (string $ env ) {
2024 return \Bnomei \DotEnv::getenv ($ env );
2125 },
2226 ],
2327]);
24-
25- if (! function_exists ('loadenv ' )) {
26- function loadenv (array $ options = [])
27- {
28- return \Bnomei \DotEnv::load ($ options );
29- }
30- }
31-
32- if (! function_exists ('env ' )) {
33- function env (string $ env )
34- {
35- return \Bnomei \DotEnv::getenv ($ env );
36- }
37- }
Original file line number Diff line number Diff line change 11<?php
22
33// load dotenv plugins class so getenv can be used outside of closures
4- require_once __DIR__ . '/../../../classes/DotEnv .php ' ;
5- // require_once __DIR__ . '/../plugins/kirby3-dotenv/classes/DotEnv .php';
4+ require_once __DIR__ . '/../../../global .php ' ;
5+ // require_once __DIR__ . '/../plugins/kirby3-dotenv/global .php';
66
77loadenv ([
88 'dir ' => realpath (__DIR__ . '/../../ ' ),
Original file line number Diff line number Diff line change @@ -27,8 +27,8 @@ class InstalledVersions
2727private static $ installed = array (
2828 'root ' =>
2929 array (
30- 'pretty_version ' => '2.0.0 ' ,
31- 'version ' => '2.0.0 .0 ' ,
30+ 'pretty_version ' => '2.0.1 ' ,
31+ 'version ' => '2.0.1 .0 ' ,
3232 'aliases ' =>
3333 array (
3434 ),
@@ -39,8 +39,8 @@ class InstalledVersions
3939 array (
4040 'bnomei/kirby3-dotenv ' =>
4141 array (
42- 'pretty_version ' => '2.0.0 ' ,
43- 'version ' => '2.0.0 .0 ' ,
42+ 'pretty_version ' => '2.0.1 ' ,
43+ 'version ' => '2.0.1 .0 ' ,
4444 'aliases ' =>
4545 array (
4646 ),
Original file line number Diff line number Diff line change 11<?php return array (
22 'root ' =>
33 array (
4- 'pretty_version ' => '2.0.0 ' ,
5- 'version ' => '2.0.0 .0 ' ,
4+ 'pretty_version ' => '2.0.1 ' ,
5+ 'version ' => '2.0.1 .0 ' ,
66 'aliases ' =>
77 array (
88 ),
1313 array (
1414 'bnomei/kirby3-dotenv ' =>
1515 array (
16- 'pretty_version ' => '2.0.0 ' ,
17- 'version ' => '2.0.0 .0 ' ,
16+ 'pretty_version ' => '2.0.1 ' ,
17+ 'version ' => '2.0.1 .0 ' ,
1818 'aliases ' =>
1919 array (
2020 ),
You can’t perform that action at this time.
0 commit comments