From c5c40a17803c8701e6123903943e12b5ed9143e3 Mon Sep 17 00:00:00 2001 From: Clemens Schwaighofer Date: Mon, 11 Oct 2021 09:10:52 +0900 Subject: [PATCH] Add example .env file and update readme --- Readme.md | 5 ++++- test/.env.example | 4 ++++ test/read_env_file.php | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 test/.env.example diff --git a/Readme.md b/Readme.md index 3a72f9f..4adecc0 100644 --- a/Readme.md +++ b/Readme.md @@ -1,9 +1,12 @@ # dotenv: readEnvFile() -A single function implementation of https://github.com/vlucas/phpdotenv +A single function implementation of This is not a functional replacement, but a very simple implementation of the basic functions. +It is recommended to create a `.env.example` example file that is checked into the +repository. The `.env` should *NEVER* be checked into anything + ## How it works Put the function where it is needed or put it in a file and load it. diff --git a/test/.env.example b/test/.env.example new file mode 100644 index 0000000..95c9b02 --- /dev/null +++ b/test/.env.example @@ -0,0 +1,4 @@ +# example enviroment file +SOMETHING= +OTHER= +Complex= diff --git a/test/read_env_file.php b/test/read_env_file.php index 95232d8..d660978 100644 --- a/test/read_env_file.php +++ b/test/read_env_file.php @@ -9,7 +9,7 @@ print "ORIG:
" . file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . '.env')
 
 $status = readEnvFile(__DIR__);
 
-print "STATUS: " . ($status ? 'OK' : 'FAIL') . "
"; +print "STATUS: " . (string)$status . "
"; print "ENV:
" . print_r($_ENV, true) . "

"; // __END__