for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace phpbu\App\Adapter;
use Dotenv\Dotenv as DotenvLib;
use phpbu\App\Adapter;
use phpbu\App\Util;
/**
* Dotenv Adapter
*
* @package phpbu
* @subpackage App
* @author Sebastian Feldmann <[email protected]>
* @copyright Sebastian Feldmann <[email protected]>
* @license https://opensource.org/licenses/MIT The MIT License (MIT)
* @link http://phpbu.de/
* @since Class available since Release 4.0.0
*/
class Dotenv implements Adapter
{
* Path to the .env file
* @var string
private $file;
* Actual dot env reader
* @var \Dotenv\Dotenv
private $dotenv;
* Setup the adapter.
* @param array $conf
* @return void
public function setup(array $conf)
$this->file = Util\Arr::getValue($conf, 'file', '.env');
$this->dotenv = new DotenvLib(dirname($this->file), basename($this->file));
$this->dotenv->load();
}
* Return a value for a given path.
* @param string $path
* @return string
public function getValue($path)
return getenv($path);