PHP code example of lwiesel / feature-checker-bundle

1. Go to this page and download the library: Download lwiesel/feature-checker-bundle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

lwiesel / feature-checker-bundle example snippets

 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');
    }
}
 php
    /**
     * @MustHaveFeature("feature1")
     * @MustHaveFeature("feature3.feature31")
     */
    public function secondAction()
    {
        return $this->render('default/second.html.twig');
    }
 php
    /**
     * @MustHaveFeature("feature3")
     */
    public function thirdAction()
    {
        return $this->render('default/third.html.twig');
    }
}