Framework agnostic environment loader that abstracts PHP dotEnv for faster env loading.
To get started, install PackageEnvLoader using the Composer package manager:
composer require solumdesignum/package-env-loader
I created this package because, I was very frustrated with this issue that I can't share my .env file between javascript frameworks due to this package was born.
<?php
declare(strict_types=1);
use SolumDeSignum\PackageEnvLoader\Contracts\PackageEnvLoaderContract;
use SolumDeSignum\PackageEnvLoader\Traits\PackageEnvLoader;
class ExampleIntegration implements PackageEnvLoaderContract
{
use PackageEnvLoader;
/**
* @var bool
*/
private array $packageEnvLoaded;
/**
* ExampleIntegration constructor.
*/
public function __construct()
{
$this->packageEnvLoaded = $this->createPackageDotenv(['.env.first.test', '.env.second.test']);
}
/**
* Define the root path for environment files.
*
* @param array $paths
*
* @return array
*/
public function packageEnvRootPath(array $paths = [__DIR__ . '/..']): string|array
{
return $paths;
}
}
Thank you for considering contributing to the PackageEnvLoader. You can read the contribution guidelines here
If you discover any security-related issues, please email to Solum DeSignum.
Solum DeSignum is a web design agency based in Latvia, Riga.
PackageEnvLoader is open-sourced software licensed under the MIT license