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