Add example .env file and update readme

This commit is contained in:
2021-10-11 09:10:52 +09:00
parent de80a9c061
commit c5c40a1780
3 changed files with 9 additions and 2 deletions

View File

@@ -1,9 +1,12 @@
# dotenv: readEnvFile()
A single function implementation of https://github.com/vlucas/phpdotenv
A single function implementation of <https://github.com/vlucas/phpdotenv>
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.

4
test/.env.example Normal file
View File

@@ -0,0 +1,4 @@
# example enviroment file
SOMETHING=
OTHER=
Complex=

View File

@@ -9,7 +9,7 @@ print "ORIG: <pre>" . file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . '.env')
$status = readEnvFile(__DIR__);
print "STATUS: " . ($status ? 'OK' : 'FAIL') . "<br>";
print "STATUS: " . (string)$status . "<br>";
print "ENV: <pre>" . print_r($_ENV, true) . "</pre><br>";
// __END__