DotEnvParser service

pull/1/head
sundowndev 2018-07-08 21:45:15 +02:00
parent f5c3f7746c
commit 6daa17764f
1 changed files with 43 additions and 0 deletions

View File

@ -0,0 +1,43 @@
<?php
namespace App\Service;
use josegonzalez\Dotenv\Loader;
class DotEnvParser
{
private $file;
private $loader;
public function __construct()
{
$this->file = __DIR__ . '/../../.env';
$this->loader = new Loader($this->file);
}
/**
* Parse the .env file
* @return bool|Loader
*/
public function parse()
{
return $this->loader->parse();
}
/**
* Send the parsed .env file to the $_ENV variable
* @return bool|Loader
*/
public function toEnv()
{
return $this->loader->toEnv();
}
/**
* @return array|null
*/
public function toArray()
{
return $this->loader->toArray();
}
}