2017 © Pedro Peláez
 

symfony-bundle setting-bundle

Symfony SettingBundle

image

foreverglory/setting-bundle

Symfony SettingBundle

  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

SettingBundle

Symfony SettingBundle, (*1)

Introduction

Composer

Add to composer.json in your project to require section:, (*2)

{
    "foreverglory/setting-bundle": "~0.1"
}

Add this bundle to your application's kernel

//app/AppKernel.php
public function registerBundles()
{
    return array(
        // ...
        new Glory\Bundle\SettingBundle\GlorySettingBundle(),
        // ...
    );
}

Configure service in your YAML configuration

#app/config/config.yml
glory_setting:
    driver:~    #default %database_driver%
    manager:~   #service id, default if driver is 'pdo_mysql', manager is @doctrine.orm.default_entity_manager
    model:~     #model class,default if driver is 'pdo_mysql', model is Glory\Bundle\SettingBundle\Entity\Setting

php code

$settingManager = $container->get('glory_setting.manager');

$settingManager->value('name');
$settingManager->value('name','default-value');

$settingManager->value('name.key');
$settingManager->value('name.key','default-value');

$settingManager->save('name','value');
$settingManager->save('name',array('key'=>'value'));

twig code

{# string #}
{{setting('name')}}
{{setting('name','default-value')}}

{# array #}
{{setting('name.key')}}
{{setting('name.key','default-value')}}

{% set value=setting('name') %}
{{value.key}}

{# Warning #}
{# 
    if setting('name') is array 
    use {{setting('name')}}
    will throw Exception("Notice: Array to string conversion")
#}

The Versions

22/05 2016

dev-master

9999999-dev http://foreverglory.me

Symfony SettingBundle

  Sources   Download

MIT

The Requires

 

bundle symfony setting

19/03 2016

v0.2.0

0.2.0.0 http://foreverglory.me

Symfony SettingBundle

  Sources   Download

MIT

The Requires

 

bundle symfony setting

19/02 2016

v0.1.1

0.1.1.0 http://foreverglory.me

Symfony SettingBundle

  Sources   Download

MIT

The Requires

 

bundle symfony setting

16/02 2016

v0.1.0

0.1.0.0 http://foreverglory.me

Symfony SettingBundle

  Sources   Download

MIT

The Requires

 

bundle symfony setting