aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorАлександр Кирюхин <alexander@kiryukhin.su>2018-01-19 03:41:53 +0300
committerАлександр Кирюхин <alexander@kiryukhin.su>2018-01-19 03:41:53 +0300
commit25fc8dbc337356ca1d726cebc3d0b081e02499f6 (patch)
treeb96ec5bc78e33edee20c0ea166677b99fa7be840
parent8de9eaf5d8e238df0421ec3df9e7248c9198f630 (diff)
Readme and license0.0.1
-rw-r--r--LICENSE21
-rw-r--r--README.md66
-rw-r--r--readme.md0
-rw-r--r--src/Dotenv.php1
4 files changed, 88 insertions, 0 deletions
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..07b7781
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,21 @@
+The MIT License
+
+Copyright (c) 2018 Alexander Kiryukhin
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE. \ No newline at end of file
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..be2fc90
--- /dev/null
+++ b/README.md
@@ -0,0 +1,66 @@
+# Dotenv
+
+[![Build Status](https://travis-ci.org/NeonXP/Dotenv.svg?branch=master)](https://travis-ci.org/NeonXP/Dotenv)
+[![Coveralls github](https://img.shields.io/coveralls/github/NeonXP/Dotenv.svg)]()
+[![GitHub issues](https://img.shields.io/github/issues/neonxp/dotenv.svg)](https://github.com/neonxp/dotenv/issues)
+[![GitHub forks](https://img.shields.io/github/forks/neonxp/dotenv.svg)](https://github.com/neonxp/dotenv/network)
+[![GitHub stars](https://img.shields.io/github/stars/neonxp/dotenv.svg)](https://github.com/neonxp/dotenv/stargazers)
+[![GitHub license](https://img.shields.io/github/license/neonxp/dotenv.svg)](https://github.com/neonxp/dotenv)
+
+## What is it?
+
+Small library, that automaticaly loads `.env` (or any other) file to applications environment.
+
+## Why not XXX?
+
+Because this library is pretty simple, without external dependencies and highly customizable.
+
+## Installation
+
+```
+composer require neonxp/dotenv
+```
+
+## Usage
+
+Basic usage:
+
+```php
+use NeonXP\Dotenv\Dotenv;
+
+$dotenv = new Dotenv();
+$dotenv->load(); // You can specify file to load at first argument
+
+print $dotenv->get('KEY', 'default') . PHP_EOL;
+print $dotenv['KEY'] . PHP_EOL;
+foreach ($dotenv as $key => $value) {
+ print "$key = $value" . PHP_EOL;
+}
+```
+
+## .env file syntax
+
+Here examples of syntax:
+
+```
+# This is a comment
+
+# Empty lines also ignored
+export KEY1=VALUE1
+KEY2 = VALUE2 # Inline comment
+KEY3 = 'VALUE3 # This is not comment'
+KEY4 = "VALUE4 # And this value too"
+KEY5 = ${KEY1} -> ${KEY2} # Compilled from another variables
+```
+
+and we will get:
+
+```php
+[
+ 'KEY1' => 'VALUE1',
+ 'KEY2' => 'VALUE2',
+ 'KEY3' => 'VALUE3 # This is not comment',
+ 'KEY4' => 'VALUE4 # And this value too',
+ 'KEY5' => 'VALUE1 -> VALUE2',
+]
+``` \ No newline at end of file
diff --git a/readme.md b/readme.md
deleted file mode 100644
index e69de29..0000000
--- a/readme.md
+++ /dev/null
diff --git a/src/Dotenv.php b/src/Dotenv.php
index 3f3b0c6..995efff 100644
--- a/src/Dotenv.php
+++ b/src/Dotenv.php
@@ -80,6 +80,7 @@ class Dotenv implements \ArrayAccess, \IteratorAggregate
);
foreach ($this->loadedValues as $key => $value) {
$_ENV[$key] = $value;
+ $_SERVER[$key] = $value;
putenv($key . "=" . $value);
}