Skip to content

Commit 6dcd202

Browse files
Allow dotenv version 3
1 parent 47791de commit 6dcd202

File tree

3 files changed

+17
-5
lines changed

3 files changed

+17
-5
lines changed

build.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,12 @@
115115
<include name="**/*.php"/>
116116
</fileset>
117117
</copy>
118+
<copy file="${basedir}/vendor/phpoption/phpoption/LICENSE.txt" tofile="${basedir}/build/phar/lib/phpoption/LICENSE"/>
119+
<copy todir="${basedir}/build/phar/lib/phpoption">
120+
<fileset dir="${basedir}/vendor/phpoption/phpoption/src">
121+
<include name="**/*.php"/>
122+
</fileset>
123+
</copy>
118124

119125
<!-- DROPBOX SDK -->
120126
<copy file="${basedir}/vendor/kunalvarma05/dropbox-php-sdk/LICENSE" tofile="${basedir}/build/phar/lib/dropbox/LICENSE"/>

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
"tightenco/collect": "5.5.*",
5454
"phpseclib/phpseclib": "~2.0",
5555
"softlayer/objectstorage": "dev-master",
56-
"vlucas/phpdotenv": "~2.4",
56+
"vlucas/phpdotenv": "~2.4|~3.0",
5757
"google/apiclient":"^2.0",
5858
"php-opencloud/openstack": "^3.0",
5959
"arhitector/yandex": "^2.0",

src/Adapter/Dotenv.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* @author Sebastian Feldmann <sebastian@phpbu.de>
1515
* @copyright Sebastian Feldmann <sebastian@phpbu.de>
1616
* @license https://opensource.org/licenses/MIT The MIT License (MIT)
17-
* @link http://phpbu.de/
17+
* @link https://phpbu.de/
1818
* @since Class available since Release 4.0.0
1919
*/
2020
class Dotenv implements Adapter
@@ -41,9 +41,15 @@ class Dotenv implements Adapter
4141
*/
4242
public function setup(array $conf)
4343
{
44-
$path = AppUtil\Arr::getValue($conf, 'file', '.env');
45-
$this->file = AppUtil\Path::toAbsolutePath($path, Configuration::getWorkingDirectory());
46-
$this->dotenv = new DotenvLib(dirname($this->file), basename($this->file));
44+
$path = AppUtil\Arr::getValue($conf, 'file', '.env');
45+
$this->file = AppUtil\Path::toAbsolutePath($path, Configuration::getWorkingDirectory());
46+
47+
if (method_exists(DotenvLib::class, 'create')) {
48+
$this->dotenv = DotenvLib::create(dirname($this->file), basename($this->file));
49+
} else {
50+
$this->dotenv = new DotenvLib(dirname($this->file), basename($this->file));
51+
}
52+
4753
$this->dotenv->load();
4854
}
4955

0 commit comments

Comments
 (0)