2017 © Pedro Pelรกez
 

library cascading-config

Bringing the cascading configuration system back to Laravel 5.

image

phanan/cascading-config

Bringing the cascading configuration system back to Laravel 5.

  • Monday, November 16, 2015
  • by phanan
  • Repository
  • 2 Watchers
  • 53 Stars
  • 56,211 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 7 Forks
  • 2 Open issues
  • 7 Versions
  • 8 % Grown

The README.md

Cascading Config

Build Status Dependency Status License, (*1)

A simple package that brings the cascading configuration system back into Laravel 5 and its sister project, Lumen., (*2)

Requirements

  • Laravel 5, or
  • Lumen >=5.1

Features

  • Laravel-4 style cascading config (can't believe I'm writing this)
  • Nested configuration is fully supported

Installation

First, require phanan/cascading-config into your composer.json and run composer update:, (*3)

    "require": {
        "phanan/cascading-config": "~2.0"
    },

An environment-based configuration directory should have a name with this format config.{APP_ENV}, and reside in the same directory as the default config dir. For Laravel, php artisan vendor:publish will create a sample directory for your local environment. For Lumen, you'll have to create the directories manually., (*4)

Your application structure now should have something like this:, (*5)

config
โ”œโ”€โ”€ app.php
โ”œโ”€โ”€ auth.php
โ”œโ”€โ”€ cache.php
โ”œโ”€โ”€ compile.php
โ”œโ”€โ”€ database.php
โ”œโ”€โ”€ mail.php
โ””โ”€โ”€ ...
config.local
โ”œโ”€โ”€ app.php
โ”œโ”€โ”€ auth.php
โ”œโ”€โ”€ cache.php
โ”œโ”€โ”€ mail.php
โ””โ”€โ”€ nested
    โ””โ”€โ”€ app.php

Fill the configuration into your environment-based config directory (config.local, config.staging, config.production), just like what you've always done in Laravel 4,, (*6)

Usage

For Laravel

  1. Add the package's service provider class into config/app.php:, (*7)

    ``` php 'providers' => [ /* * ... */ App\Providers\AppServiceProvider::class, App\Providers\EventServiceProvider::class, App\Providers\RouteServiceProvider::class,, (*8)

    PhanAn\CascadingConfig\CascadingConfigServiceProvider::class,

    ], ```, (*9)

  2. Call config($key), (*10)

For Lumen

  1. Register the service provider class in bootstrap/app.php:, (*11)

    // $app->register(App\Providers\AppServiceProvider::class);
    // $app->register(App\Providers\EventServiceProvider::class);
    $app->register(PhanAn\CascadingConfig\CascadingConfigServiceProvider::class);
    
  2. Enable multi-environment support by uncommenting this line:, (*12)

    Dotenv::load(__DIR__.'/../');
    
  3. Manually register the configuration arrays:, (*13)

    $app->configure('auth');
    $app->configure('cache');
    $app->configure('mail');
    
  4. Call config($key), (*14)

Notes

Because of the way array_merge_recursive() works, a config key with value being an indexed (non-associative) array (for instance, app.providers) will have the value's items overridden. See #6 for more details on this behavior, and how to work around it., (*15)

License

MIT ยฉ Phan An, (*16)

The Versions

16/11 2015

dev-master

9999999-dev https://github.com/phanan/cascading-config

Bringing the cascading configuration system back to Laravel 5.

  Sources   Download

MIT

The Development Requires

laravel configuration config laravel 5 cascade cascading

16/11 2015

dev-analysis-Xpd9RX

dev-analysis-Xpd9RX https://github.com/phanan/cascading-config

Bringing the cascading configuration system back to Laravel 5.

  Sources   Download

MIT

The Development Requires

laravel configuration config laravel 5 cascade cascading

16/11 2015

2.0.0

2.0.0.0 https://github.com/phanan/cascading-config

Bringing the cascading configuration system back to Laravel 5.

  Sources   Download

MIT

The Development Requires

laravel configuration config laravel 5 cascade cascading

25/08 2015

dev-analysis-8jvlJ8

dev-analysis-8jvlJ8 https://github.com/phanan/cascading-config

Bringing the cascading configuration system back to Laravel 5.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel configuration config laravel 5 cascade cascading

18/06 2015

1.0.3

1.0.3.0 https://github.com/phanan/cascading-config

Bringing the cascading configuration system back to Laravel 5.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel configuration config laravel 5 cascade cascading

18/06 2015

1.0.2

1.0.2.0 https://github.com/phanan/cascading-config

Bringing the cascading configuration system back to Laravel 5.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel configuration config laravel 5 cascade cascading

13/04 2015

1.0.0

1.0.0.0 https://github.com/phanan/cascading-config

Bringing the cascading configuration system back to Laravel 5.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel configuration config laravel 5 cascade cascading