| 1 | <?php |
||
| 5 | class Loader |
||
| 6 | { |
||
| 7 | /** |
||
| 8 | * Set the env file |
||
| 9 | */ |
||
| 10 | protected $file; |
||
| 11 | |||
| 12 | protected $parser; |
||
| 13 | |||
| 14 | 21 | public function __construct($path, $filename = '.env') |
|
| 20 | |||
| 21 | /** |
||
| 22 | * parse and set the env |
||
| 23 | * |
||
| 24 | * @return self |
||
| 25 | */ |
||
| 26 | 18 | public function load() |
|
| 34 | |||
| 35 | /** |
||
| 36 | * Parse the env file |
||
| 37 | * |
||
| 38 | * @return self |
||
| 39 | */ |
||
| 40 | 18 | public function parse() |
|
| 48 | |||
| 49 | /** |
||
| 50 | * Return the parser |
||
| 51 | * |
||
| 52 | * @return Rfussien\Dotenv\Parser |
||
| 53 | */ |
||
| 54 | 3 | public function getParser() |
|
| 58 | |||
| 59 | 21 | public function toEnv() |
|
| 71 | |||
| 72 | /** |
||
| 73 | * Set an env variable into $_ENV, $_SERVER and putenv |
||
| 74 | */ |
||
| 75 | 18 | public static function putenv($key, $value) |
|
| 86 | |||
| 87 | /** |
||
| 88 | * Return the value of an environment variable |
||
| 89 | */ |
||
| 90 | 12 | public static function getenv($key, $default = null) |
|
| 104 | } |
||
| 105 |