bazo / nette-features-extension
Nette 框架的功能切换扩展
dev-master
2018-09-27 18:34 UTC
Requires
- php: >=5.4.0
- bazo/feature-toggler: *
- nette/di: *
Requires (Dev)
- nette/tester: *
This package is not auto-updated.
Last update: 2024-09-14 16:44:25 UTC
README
PHP 的功能切换库
使用方法
注册扩展
extensions:
features: Bazo\FeatureToggler\DI\FeaturesExtension
配置功能,更多信息请参阅 https://github.com/bazo/feature-toggler#feature-toggler
features:
features:
globals:
ip: %remoteIp%
analytics:
conditions:
- {ip, in, %remoteIps%}
zopim:
conditions:
- {ip, in, %remoteIps%}
facebook-like:
conditions:
- {ip, in, %remoteIps%}
login:
conditions:
- {ip, in, %allowedIps%}
registration:
conditions:
- {ip, in, %allowedIps%}
membership:
active: FALSE
在 Latte 中可以使用宏
{ifEnabled feature $context} or {ifEnabled feature [username => bazo]}
feature is enabled
{else}
not enabled
{/ifEnabled}
或 n-macros
<div n:ifEnabled="feature $context">
feature is enabled
</div>
还有一个未启用的替代选项 ifNotEnabled