Coder Social home page Coder Social logo

rcm-config's Introduction

RCM Config

Module title:

RCM Config

Module description:

Extend the functionality of ZF2 config as well as allow config sources to be changed

  • Models my be written and injected to pull from any source by category
  • ZF2 ConfigModel and Doctine ConfigModel is available by default
  • Allows for config sources to be changed without impact to existing code
  • Allows for a standard for storing config values
Config Example:
<?php
    // Example of a config array as might be defined in ZF2 config
    'Reliv\RcmConfig' => [
        'myCategory' => [
            '_DEFAULT' => [
                'myPropertyName1' => 'my value',
                'myPropertyName2' => ['my value1', 'my value2'],
            ],
            'myContext' => [
                'myPropertyName1' => 'my value over-ride',
            ]
        ]
    ],
    // Example of defining a model for a category
    'Reliv\RcmConfig\Models' => [
        'myCategory' => \Reliv\RcmConfig\Model\ConfigModel::class,
    ],
Usage Example
<?php
    /** Using /Zend\ServiceManager/ServiceManager as $serviceLocator */

    $configService = $serviceLocator->get(\Reliv\RcmConfig\Service\ConfigService::class);

    $value = $configService->getValue(
        'myCategory',
        'myContext',
        'myPropertyName1'
    );
    /** Outputs: 'my value over-ride' */
    var_dump($value);
    
    $value = $configService->getValue(
        'myCategory',
        'myContext',
        'myPropertyName2'
    );
    /** Outputs: ['my value1', 'my value2'] */
    var_dump($value);
    
    /** Other Methods */
    var_dump(
        'getList',
        $cs->getList('myCategory'),
        'getAll',
        $cs->getAll('myCategory', 'myContext'),
        'getDefault',
        $cs->getDefault('myCategory'),
        'getListValue',
        $cs->getListValue('myCategory', 'myPropertyName1'),
        'getPrimary',
        $cs->getPrimary('myCategory', 'myContext')
    );
Project author:

James Jervis

[email protected]

https://github.com/reliv/rcm-config

Copyright (c) 2015, Reliv' International

rcm-config's People

Contributors

rodmcnew avatar bradharms avatar jerv13 avatar

Watchers

James Cloos avatar  avatar  avatar Westin Shafer avatar  avatar Brian Janish avatar  avatar  avatar  avatar  avatar  avatar Marie avatar

Forkers

jerv13 rodmcnew

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.