2017 © Pedro Peláez
 

library zf-local-config-module

Module responsible for adding custom config.

image

rstgroup/zf-local-config-module

Module responsible for adding custom config.

  • Wednesday, July 26, 2017
  • by rstgroup
  • Repository
  • 14 Watchers
  • 0 Stars
  • 3 Installations
  • PHP
  • 0 Dependents
  • 1 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

ZF Local Config Module

This module allows you to dynamically adjust configuration of your application via command-line interface., (*1)

Installation

Require module with Composer:, (*2)

composer require rstgroup/zf-local-config-module

The next step is adding module to ZF system configuration (config/application.config.php):, (*3)

return [
    'modules' => [
        (...),
        'RstGroup\ZfLocalConfigModule',
    ],
    (...)
]

... and providing the required configuration in your application's config:, (*4)

return [
    'rst_group' => [
        'local_config' => [
            'filename' => 'config/autoload/dynamic-config.local.php'
        ],
    ],
];

Usage

The module provides command-line commands to help managing local, dynamically generated, application configuration., (*5)

Setting configuration

Setting configuration is as simple as writing the line:, (*6)

php public/index.php local-config set path.to.value string-value

This will result in writing the code into config/autoload/dynamic-config.local.php file:, (*7)

return [
    'path' => [
        'to' => [
            'value' => 'string-value'
        ],
    ],
];

By default, all values passed via command line are treated as strings. To set value of any simple type, you can use JSON notation. To enable it, just add --json flag., (*8)

Look at some of the examples below:, (*9)

# setting a number
php public/index.php local-config set path.to.value 1234 --json
# setting null
php public/index.php local-config set path.to.value null --json

JSON notation can also be used to set a structure or an array in given path:, (*10)

# setting an array
php public/index.php local-config set array "[1,2,3,4]" --json
# setting complex structure
php public/index.php local-config set structure '{"complex":{"structure":{"x":"y"},"x":null}}' --json

The result of these two commands ran one after another would be a config/autoload/dynamic-config.local.php file like:, (*11)

return [
    'array' => [ 1, 2, 3, 4 ],
    'complex' => [
        'structure' => [
            'x' => 'y'
        ],
        'x' => null,
    ],
];

The Versions

26/07 2017

dev-master

9999999-dev

Module responsible for adding custom config.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Artur Wolny

26/07 2017

1.0

1.0.0.0

Module responsible for adding custom config.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Artur Wolny