Quandidate toggle bundle provides toggling for the particulare features by simple configuartions in symfony, By using this bundle you can easily hide/display some features in your symfony application. Please check Quandidate/Toggle on Github.
composer require qandidate/toggle-bundle ~0.1
$bundles = array( new Qandidate\Bundle\ToggleBundle\QandidateToggleBundle() )
qandidate_toggle: persistence: in_memory|redis context_factory: null|your.context_factory.service.id redis_namespace: toggle_%kernel.environment% redis_client: null|your.redis_client.service.id
/* Your service.yml */ acme.controller: class: YourClass arguments: ['qandidate.toggle.manager', 'qandidate.toggle.user_context_factory'] /* YourController */ public function __construct(ToggleManager $manager, ContextFactory $contextFactory) { $this->manager = $manager; $this->context = $contextFactory->createContext(); } public function controllerAction(Request $request) { $this->article = $this->repository->findBySlug($request->request->get('slug')); return $this->templating->render('article.html.twig', array( 'article' => $article, 'enableComments' => $this->manager->active('comments', $this->context), )); }
{% if feature_is_active('comments') %} {{ "comments feature is active" }} {% endif %}