Add example .env file and update readme
This commit is contained in:
@@ -1,9 +1,12 @@
|
|||||||
# dotenv: readEnvFile()
|
# 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.
|
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
|
## How it works
|
||||||
|
|
||||||
Put the function where it is needed or put it in a file and load it.
|
Put the function where it is needed or put it in a file and load it.
|
||||||
|
|||||||
4
test/.env.example
Normal file
4
test/.env.example
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
# example enviroment file
|
||||||
|
SOMETHING=
|
||||||
|
OTHER=
|
||||||
|
Complex=
|
||||||
@@ -9,7 +9,7 @@ print "ORIG: <pre>" . file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . '.env')
|
|||||||
|
|
||||||
$status = readEnvFile(__DIR__);
|
$status = readEnvFile(__DIR__);
|
||||||
|
|
||||||
print "STATUS: " . ($status ? 'OK' : 'FAIL') . "<br>";
|
print "STATUS: " . (string)$status . "<br>";
|
||||||
print "ENV: <pre>" . print_r($_ENV, true) . "</pre><br>";
|
print "ENV: <pre>" . print_r($_ENV, true) . "</pre><br>";
|
||||||
|
|
||||||
// __END__
|
// __END__
|
||||||
|
|||||||
Reference in New Issue
Block a user