1. Go to this page and download the library: Download novaway/feature-flag-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/ */
use Novaway\Bundle\FeatureFlagBundle\Manager\FeatureManager;
// ...
class MyController extends Controller
{
public function myAction(FeatureManager $featureManager): Response
{
if ($featureManager->isEnabled('my_feature_1')) {
// my_feature_1 is enabled
}
if ($featureManager->isDisabled('my_feature_2')) {
// my_feature_2 is not enabled
}
// ...
}
}
#[FeatureEnabled(name: "foo")]
class MyController extends Controller
{
#[FeatureEnabled(name: "foo", exceptionClass: BadRequestHttpException::class)]
public function annotationFooEnabledAction(): Response
{
return new Response('MyController::annotationFooEnabledAction');
}
#[FeatureDisabled(name: "foo", exceptionFactory: MyExceptionFactory::class)]
public function annotationFooDisabledAction(): Response
{
return new Response('MyController::annotationFooDisabledAction');
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.