aamant / config-bundle
Symfony ConfigBundle
0.0.1
2017-04-17 09:40 UTC
Requires
- php: >=5.6.0
- symfony/form: ^2.8 || ^3.0
- symfony/framework-bundle: ^2.8 || ^3.0
- symfony/security-bundle: ^2.8 || ^3.0
- symfony/templating: ^2.8 || ^3.0
- symfony/twig-bundle: ^2.8 || ^3.0
- twig/twig: ^1.28 || ^2.0
Requires (Dev)
- phpunit/phpunit: ^6
This package is not auto-updated.
Last update: 2024-09-29 02:28:59 UTC
README
安装
使用composer安装
composer require aamant/config-bundle
修改AppKernel.php
$bundles = [
...
new Aamant\ConfigBundle\AamantConfigBundle(),
...
];
添加路由
aamant_config_config:
prefix: /config
resource: "@AamantConfigBundle/Resources/config/routing.xml"
使用服务
$service = $this->getContainer()->get('aamant_config.config');
使用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')
翻译
使用config
域来翻译属性的名称
管理属性值
http://my-app/app_dev.php/config