solumdesignum / package-env-loader
Framework agnostic environment loader that abstracts PHP dotEnv for faster env loading.
Requires
- php: ^8.1|^8.2|^8.3|^8.4
- vlucas/phpdotenv: ^v5.6.0
Requires (Dev)
- mockery/mockery: ^1.4
- orchestra/testbench: ^5|^6|^7|^8|^9
- phpunit/phpunit: ^8|^9|^10|^11
- sempro/phpunit-pretty-print: ^1.4
README
Introduction
Framework agnostic environment loader that abstracts PHP dotEnv for faster env loading.
Installation
To get started, install PackageEnvLoader using the Composer package manager:
composer require solumdesignum/package-env-loader
Origins
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.
Usage
<?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; } }
Contributing
Thank you for considering contributing to the PackageEnvLoader. You can read the contribution guidelines here
Security
If you discover any security-related issues, please email to Solum DeSignum.
Credits
About
Solum DeSignum is a web design agency based in Latvia, Riga.
License
PackageEnvLoader is open-sourced software licensed under the MIT license