solumdesignum/package-env-loader

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

v2.01 2024-09-01 10:27 UTC

This package is auto-updated.

Last update: 2024-12-13 16:25:22 UTC


README

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