Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

environment-loader

Environment-agnostic helper for composition roots: register include files per module and environment name, then resolve absolute paths for require.

Depends on amtgard/builder-traits (Builder/Getter) and jedibc/optional for binding selection and optional logging.

Install

composer require amtgard/environment-loader

Usage

use Amtgard\EnvironmentLoader\EnvironmentLoader;

$environment = getenv('APP_ENV') ?: 'environment-one';

$envLoad = EnvironmentLoader::builder()
    ->build()
    ->defaultPath('environment-one', '/path/to/live/container')
    ->defaultPath('environment-two', '/path/to/integ/container');

$envLoad->register('oauth')
    ->withEnvironment('environment-one', 'oauth-providers.php', EnvironmentLoader::DEFAULT)
    ->withEnvironment('environment-two', 'oauth-providers-integ.php');

(require $envLoad->emit('oauth', $environment))($containerBuilder);

Optional PSR-3 logger: EnvironmentLoader::builder()->logger($logger)->build()->defaultPath(...).

Development

composer install
composer test

About

Provider for producing alternate paths to load files based on the environment

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages