Skip to content

Framework agnostic environment loader that abstracts PHP dotEnv for faster env loading.

License

Notifications You must be signed in to change notification settings

SolumDeSignum/package-env-loader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

StyleCI Scrutinizer Code Quality Total Downloads Latest Stable Version Latest Unstable Version MIT Licensed

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