bugsnag / bugsnag-php

BugSnag error monitoring and crash reporting tool for PHP apps
https://docs.bugsnag.com/platforms/php
MIT License
554 stars 77 forks source link

Add feature flags & experiments API #646

Closed imjoehaines closed 2 years ago

imjoehaines commented 2 years ago

Goal

This PR adds the feature flags & experiments API to Bugsnag PHP. The API exists in the Client, Configuration and Report classes, which implement the new FeatureDataStore interface:

interface FeatureDataStore
{
    public function addFeatureFlag($name, $variant = null);
    public function addFeatureFlags(array $featureFlags);
    public function clearFeatureFlag($name);
    public function clearFeatureFlags();
}

Feature flags are stored on both the Configuration and Report (the Client forwards method calls on to the Configuration), allowing feature flags to be added globally (via Configuration) or to individual reports as required