Define features, and check if they are activated or not in your Symfony2 application.
Define a feature configuration in your config.yml
.
# app/config/config.yml
feature_checker:
features:
feature1: true
feature2: false
feature3:
feature31: true
feature32: true
Then use the features names in controller annotations. Only the allowed features will execute the action.
<?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');
}
}
Sub-features can be checked with this notation:
/**
* @MustHaveFeature("feature1")
* @MustHaveFeature("feature3.feature31")
*/
public function secondAction()
{
return $this->render('default/second.html.twig');
}
You can also test whole feature sets. A feature set is considered enabled when all sub-features -at any sub-level- is enabled.
/**
* @MustHaveFeature("feature3")
*/
public function thirdAction()
{
return $this->render('default/third.html.twig');
}
}
Please see Full documentation for details.
$ bin/phpspec run
Please see CONTRIBUTING for details.
Please see CHANGELOG for details.
If you discover any security related issues, please email wiesel.laurent@gmail.com instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.