Feature toggles (also called feature switch, feature flag, feature flipper, conditional feature, etc) is a technique used in software development in a continues deployment environment, where features that are not-yet-ready are deployed to production, but are turned off using a config flag. This practice allows developers to deploy unstable code to production, and once the feature is ready or stable, it can just be enabled.
Martin Fowler wrote an article about feature toggles, where he explains how feature toggles work in an agile environment.
But there are a lot of questions on ‘how’ do you implement feature toggles in your project.
I recently wrote a library (called Toggler) that allows you to use feature toggles in almost any PHP project. It also has a Twig extension, to disable certain UI elements, and it has support to integrate into Symfony.
Specifying if a feature should be enabled or disabled, you need to set up the config:
$features = [
'some-feature' => true,
'another-feature' => false
];
toggleConfig($features);
The config can be used in several ways.
The first way, is to use an ‘if’ statement to check if a feature is enabled or note, and run a piece of code when the feature is enabled
if (toggle('some-feature')) {
// some-feature is enabled, and we can run our code here
}
Another way is to execute a callback if a feature is enabled
toggle('some-feature', function () {
// Code here to execute when 'some-feature' is enabled
});
Toggler also comes with a Twig extension, which you can use to disable UI elements in a page. This is useful in the case where you want to hide a link to a page that is not yet available.
The Twig extension allows you to wrap features in a tag, which will hide when the feature is not enabled
{% toggle 'some-feature' %}
This content will be hidden when 'some-feature' is not enabled
{% endtoggle %}
You can also use the `toggle()` function in a condition
Visit this link
An important note about feature toggles, is to not wrap every piece of code for a feature in a toggle. If you are creating a new page, then just hide the link to that page with a toggle. Or if you are making changes to any business logic, then just wrap the calling function in a toggle. This makes it easier to remove the toggles when all the code is in production and stable.
First of all I would like tto say superb blog! I had a quick question which I’d like to assk if you don’t mind.
I was interested too find out how you center yourself and clear your head before writing.
I have hhad a difficult time clearing myy thoughts in getting my ideas out.
I truly do enjoy writing however it just seems like the
first 10 to 15 minutes are generally wasted just trying to figure out how to begin. Any ideas or hints?
Thank you!
Die moderne Casino-Sene in Deutschland entwickelt sich ontinuierlich und bietet Spielern einne umfangreiche Vielfalt an nneuen und etablierten Websites.
Besonders seit der neuen Regulierung achten viele Spieler stärker auff verlässliche Strukturen.
Ein regulierter Anbieter zeichnet sicch durch klare Bonusbedingungen aus und
ermöglicht eine stabile Spielumgebung.
Dennoch bevorzugen zahlreichge Spieler nach neuen Funktionen und aktuellen Slots.
Insgesamt bietet die deutsche Glücksspielbranche eine ausgewogene Mischung auus Sicherheit und Unterhaltung.
The online casino industry continues to expand rapidly, offering players a
diverse mix of gaming sites.
Recently, many users have becomee more focused on security and fairness, choosing platforms that provide verified game results.
A trusted gaming operator typically offers consistent payouts and supports effective acccount controls.
At the sae time, users look for updated titles and enjoy
smmooth navigation.
Overall, the current iGaming sector provides a balanced combination of entertainment and safety, making it an appealing option for many different tyhpes
of players.
Today’s digital casino market continues to expand rapidly, offering players a large variety off reliable operators.
Over the ast few seasons, many users have become more focused on licensing and transparency, choosing platforms that
provode verified game results.
A reputable casino typically offers stable financial handling and supports
effective account controls.
At the same time, players look for updated titles and enjoy fast-loading
game libraries.
Overall, the online casino scene provides a mix of regulation and
gameplay variety, making it an appealing option for many differrent types of players.
Today’s digitazl casino market continues tto grow steadily,
offering players a diverse mix of gaming sites.
In recent years, many users have become more focused on security
and fairness, choosinbg platforms tat provide independent RNG audits.
A well-regulated platform typically offers consistent
payouts and supporrts responsible gambling tools.
At the same time, regtular visitors look for updatged titles and enjoy fast-loading game libraries.
Overall, the wider casino market provides a blennd off modern features and structured oversight,
making it an appealing option for many diferent types of players.
El sehtor de los casinos online en España ha experimentdo una evolución notale en los últimos años.
A partir del sistema de licencias vigente, los usuarios pueden acceder a plataformas quue garantizan transparencia real.
Los casinos regulados deben cumplir requisitos técnicos verificables, lo que
permite un funcionamento predecible.
Los usuarios habituaes suelen buscar juegos compatibles con dispositiivos móviles y
valoran especialmente laa rapidez en pagos.
En conjunto, el ecosistema español de casinos commbina supervisión continua y tecnología, posicionándose como uno de
los más estructurados dde Europa.