diff --git a/build.xml b/build.xml index daa3369f..3b40a442 100644 --- a/build.xml +++ b/build.xml @@ -115,6 +115,12 @@ + + + + + + diff --git a/composer.json b/composer.json index 3e581123..b3933e21 100644 --- a/composer.json +++ b/composer.json @@ -53,7 +53,7 @@ "tightenco/collect": "5.5.*", "phpseclib/phpseclib": "~2.0", "softlayer/objectstorage": "dev-master", - "vlucas/phpdotenv": "~2.4", + "vlucas/phpdotenv": "~2.4|~3.0", "google/apiclient":"^2.0", "php-opencloud/openstack": "^3.0", "arhitector/yandex": "^2.0", diff --git a/src/Adapter/Dotenv.php b/src/Adapter/Dotenv.php index 5d01b791..3a207b5e 100644 --- a/src/Adapter/Dotenv.php +++ b/src/Adapter/Dotenv.php @@ -14,7 +14,7 @@ * @author Sebastian Feldmann * @copyright Sebastian Feldmann * @license https://opensource.org/licenses/MIT The MIT License (MIT) - * @link http://phpbu.de/ + * @link https://phpbu.de/ * @since Class available since Release 4.0.0 */ class Dotenv implements Adapter @@ -41,9 +41,15 @@ class Dotenv implements Adapter */ public function setup(array $conf) { - $path = AppUtil\Arr::getValue($conf, 'file', '.env'); - $this->file = AppUtil\Path::toAbsolutePath($path, Configuration::getWorkingDirectory()); - $this->dotenv = new DotenvLib(dirname($this->file), basename($this->file)); + $path = AppUtil\Arr::getValue($conf, 'file', '.env'); + $this->file = AppUtil\Path::toAbsolutePath($path, Configuration::getWorkingDirectory()); + + if (method_exists(DotenvLib::class, 'create')) { + $this->dotenv = DotenvLib::create(dirname($this->file), basename($this->file)); + } else { + $this->dotenv = new DotenvLib(dirname($this->file), basename($this->file)); + } + $this->dotenv->load(); }