bestit / flagception-bundle

Feature flags on steroids!
MIT License
210 stars 42 forks source link

Enable service for symfony routing condition option #99

Open tacman opened 2 years ago

tacman commented 2 years ago

The latest version of Symfony allows the routing condition to access a service, so developers can write:

    #[Route('/demo', name: 'app_demo', condition: "service('flagception.manager.feature_manager').isActive('beta')")]
    public function demo(): Response
    {
        return $this->render('app/index.html.twig', [
            'controller_name' => 'Demo',
        ]);
    }

I'll submit a PR to tag the service so it can be used this way.