webmakers / symfony-setting-bundle
用于将网站设置存储在数据库表的Symfony2 Bundle
dev-master
2022-08-15 09:34 UTC
Requires
- php: >=5.5.0
- symfony/framework-bundle: ~3.0
This package is not auto-updated.
Last update: 2024-09-24 06:31:38 UTC
README
用于将应用程序设置存储在数据库表的Symfony Bundle
安装
首先将其添加到您的 composer.json 中,然后通过运行Composer下载并安装此Bundle
{ "require": { "webmakers/symfony-setting-bundle": "dev-master" } }
来安装
// In shell composer update webmakers/symfony-setting-bundle
注意:一旦我们有了标记的稳定版本,您应该使用标记的版本而不是master分支。
启用Bundle
// in app/AppKernel.php public function registerBundles() { $bundles = array( // ... new Webmakers\SettingBundle\WebmakersSettingBundle(), ); // ... return $bundles; }
创建表
// In shell php app/console doctrine:schema:update --force
使用方法
控制器
$this->get('wm.setting')->getSetting('SETTING_NAME');
Twig
{{ get_setting('SETTING_NAME') }}