lwiesel / feature-checker-bundle
在 Symfony2 应用程序中启用和禁用功能特性。
v1.1.0
2015-03-03 14:35 UTC
Requires
- php: >=5.3.2
- doctrine/common: ~2.4
- lwiesel/feature-checker: ~1.1
- symfony/framework-bundle: ~2.3
- symfony/twig-bundle: ~2.3
Requires (Dev)
- henrikbjorn/phpspec-code-coverage: ~1.0
- phpspec/phpspec: ~2.1
- phpunit/phpunit: 4.*
- scrutinizer/ocular: ~1.1
This package is not auto-updated.
Last update: 2024-09-14 16:29:28 UTC
README
定义功能,并检查它们是否在您的 Symfony2 应用程序中激活。
使用方法
在您的 config.yml 中定义功能配置。
# app/config/config.yml feature_checker: features: feature1: true feature2: false feature3: feature31: true feature32: true
然后在控制器注解中使用功能名称。只有允许的功能才会执行操作。
<?php // src/AppBundle/Controller/DefaultController.php namespace AppBundle\Controller; use LWI\FeatureCheckerBundle\Annotations\MustHaveFeature; use Symfony\Bundle\FrameworkBundle\Controller\Controller; class DefaultController extends Controller { /** * @MustHaveFeature("feature1") */ public function indexAction() { return $this->render('default/index.html.twig'); } }
可以使用此符号检查子功能
/** * @MustHaveFeature("feature1") * @MustHaveFeature("feature3.feature31") */ public function secondAction() { return $this->render('default/second.html.twig'); }
您还可以测试整个功能集。当一个功能集的所有子功能(在任何子级别)都启用时,该功能集被视为已启用。
/** * @MustHaveFeature("feature3") */ public function thirdAction() { return $this->render('default/third.html.twig'); } }
安装
有关详细信息,请参阅 完整文档。
测试
$ bin/phpspec run
贡献
有关详细信息,请参阅 贡献指南。
更新日志
有关详细信息,请参阅 更新日志。
安全
如果您发现任何与安全相关的问题,请通过电子邮件发送到 wiesel.laurent@gmail.com,而不是使用问题跟踪器。
致谢
许可证
MIT 许可证(MIT)。有关更多信息,请参阅 许可证文件。