vladab/featuretogglebundle

功能开关

安装次数: 5,525

依赖者: 0

建议者: 0

安全性: 0

星标: 1

关注者: 2

分支: 7

类型:symfony-bundle

0.3.0 2016-03-09 10:42 UTC

This package is not auto-updated.

Last update: 2024-09-14 18:47:29 UTC


README

此包通过添加一些简单的标签到twig并扩展其配置,帮助您轻松地在Symfony2中配置功能开关。

它处于开发中,尽管它是可用的,但其行为和配置可能会(并且将会)改变。

配置您的功能

将以下行添加到您的config.yml文件中

feature_toggle:
	features:
		my_feature:
			name: my_feature # the name you use in your template
			enabled: true    # false

在您的模板中使用功能开关

一旦您配置了功能,您就可以在Twig模板中将代码块用feature标签包围。

{% feature 'my_feature' %}
    ... add you code
{% endfeature %}

现在在config.yml中将enabled: false设置为将隐藏所有使用相同功能名称定义的代码部分。每次配置更改后,不要忘记清除您的缓存以更新模板。