openify/configuration-bundle

A Bundle which allow you to easily store and manage your application configuration

dev-master 2013-09-08 01:25 UTC

This package is not auto-updated.

Last update: 2021-11-20 14:15:21 UTC


README

A bundle which allow you to easily store you application configuration.

#Install

composer.json

{
    "require": {
        "openify/configuration-bundle": "dev-master"
    },
}

app/appKernel.php

        $bundles = array(
            // [...]
            Openify\Bundle\ConfigurationBundle\OpenifyConfigurationBundle(),
        );

app/config/config.yml

Custom table prefix:

parameters:
    openify.configuration.table_prefix:  page_

#Usage

  1. In a controller

    $sitename = $this->container->get('openify.configuration')->get('site_name', 'default_value');
  2. In a view

    {{ openify_configuration.get('site_name', 'default_value') }}
  3. Use with namespace

    $sitename = $this->container->get('openify.configuration')->get('site_name', 'default_value', 'namespace');
    {{ openify_configuration.get('site_name', 'default_value', 'namespace') }}