Feature Flag and Strategy pattern with the Symfony framework
π The feature flag is a method to update and change the behavior of an application without changing the code.
I did a video about this topic (π₯ pardon my French π₯).
Most of the time the feature flag is stored in a table, with a simple boolean, and when you want to check if the toggle is enabled you fetch the good row based on the feature name and check if itβs enabled or not, but what if we want to store our feature flag in a different place or we want to rely it on a specific period or we want to check dynamically based on a current context.
β‘οΈ In this article, we will use the magic of Symfony πͺ to make a Feature Flag extendable as you wantπ.
π‘ For my use case, I want to have the possibility of having different resolvers to fetch my feature flag.
Letβs write some User Stories to make things more clear π π
- As a Developer, my feature flag can be in a table (in a database).
- As a Developer, my feature flag can be configured with the Symfony parameters.
- As a Developer, my feature flag can be enabled during a specific period
- As a Developer, my feature flag can be enabled with A/B testing algorithm