2017 © Pedro Peláez
 

library config-bundle

Symfony ConfigBundle

image

aamant/config-bundle

Symfony ConfigBundle

  • Tuesday, February 13, 2018
  • by aamant
  • Repository
  • 1 Watchers
  • 0 Stars
  • 69 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 130 % Grown

The README.md

README

Install

Install with composer, (*1)

composer require aamant/config-bundle, (*2)

Modify AppKernel.php, (*3)

$bundles = [
    ...
    new Aamant\ConfigBundle\AamantConfigBundle(),
    ...
];

Add routes, (*4)

aamant_config_config:
    prefix: /config
    resource: "@AamantConfigBundle/Resources/config/routing.xml"

Use service

$service = $this->getContainer()->get('aamant_config.config');

Use add, get, has, delete

$config->set('version', '0.0.1')
// hidden attribute
$config->set('version', '0.0.1', true)
// get
$config->get('version')
// has
$config->has('version')
// delete
$config->delete('version')

Translate

use config domain for translate name of the attribute, (*5)

Manage attributes values

http://my-app/app_dev.php/config

The Versions