4 ms·
Feature Switching in PHP
- smt88 10y agoThe proper way to do this is with branches, not with hard-coded logic
- jonobird1 10y agoThat's one option. However the issue with that is if you have multiple environments (e.g. three test environments, staging and production) and you want to have the code in a state of continuous deployment, then you use your branch for your feature, merge it in with this feature switch and when it gets to staging and you realise there's a bug, you can simply switch the feature off without it causing an issue rather than having to remove code from a merge.
- smt88 10y agoYou shouldn't merge until you've tested and are fairly certain there isn't a bug. Bugs in staging shouldn't be common and fixes should be fairly quick and easy. That's what staging is for, after all.
- jonobird1 10y agoI work in a code base that's 5 million lines of code. It happens. That aside, it's very useful for launching features. I have used this practice at Expedia and works well.
- jonobird1 10y agoThis is also works well for launching a feature as it's a simple on/off switch - simply git ignore the features.php file to have a different one in each environment.