Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: open-feature/php-sdk
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 2.1.2
Choose a base ref
...
head repository: open-feature/php-sdk
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 2.2.0
Choose a head ref
  • 2 commits
  • 21 files changed
  • 2 contributors

Commits on Jun 8, 2026

  1. feat: Implement Multiprovider feature (#159)

    ## Summary
    
    Adds a new feature that lets you plug in more than one feature flag
    provider at the same time. Instead of picking one provider up front, you
    can give the SDK a list, and it will try them in a defined order (or
    pattern) and return the first good answer. If none succeed, you get a
    single combined error.
    
    ## Why this is useful
    
    Real apps often use multiple sources for flags (primary remote service,
    fallback local file, experimentation provider, etc.). This feature
    avoids hand-written chaining logic and gives a simple, uniform way to
    try multiple providers.
    
    ## How it works (plain flow)
    
    1. You create a `Multiprovider` and pass an array of providers. You may
    optionally name each provider. If you do not name one, the code gives it
    a unique name automatically.
    2. You call `resolveXValue(...)` (boolean, string, int, float, object)
    on the multiprovider.
    3. A strategy decides which providers to try and when to stop.
    4. Each provider is asked for the flag value (one at a time for the
    default strategy).
    5. If one returns a successful value, that result is returned
    immediately.
    6. If all fail (throw or error), a single error result is returned
    summarizing the failure.
    
    ## Main classes in simple terms
    
    - `Multiprovider`: The coordinator. Holds all the providers, calls them
    in order, chooses a strategy, and returns the final answer.
    - `BaseEvaluationStrategy`: A template for “how to walk through the
    list.” It defines the decision points (should we try this provider?
    should we move to the next? how do we pick the final result?).
    - `FirstMatchStrategy` (default): Tries providers in order, returns the
    first success, stops early.
    - `FirstSuccessfulStrategy`: Alternative strategy with slightly
    different stop rules (still about first success).
    - `ProviderResolutionResult`: A small wrapper for one provider’s attempt
    (either a value or an error).
    - `FinalResult`: The final outcome after all attempts (either a single
    good value or a bundle of errors).
    - `StrategyEvaluationContext` / `StrategyPerProviderContext`: Helper
    objects carrying flag info and provider-specific context so strategies
    can make simple yes/no decisions.
    
    ## Backward compatibility
    
    - Existing code using a single provider is unchanged.
    - No existing public APIs were removed or altered.
    - The new classes are additive and live in their own folder.
    - If you do nothing, the SDK works exactly as before.
    
    ## Testing
    
    What was added:
    
    - Tests for the multiprovider basic resolution path.
    - Tests for strategies (ensuring the first matching provider wins; error
    path when all fail).
    - Tests for final result object (success vs aggregated errors).
    - Tests for validation (rejects duplicate explicit names, rejects empty
    name strings).
    
    ## Simpler example
    
    ```php
    $multi = new Multiprovider([
        ['provider' => $primary],
        ['name' => 'audit', 'provider' => $audit],
        ['provider' => $fallback],
    ]);
    
    $result = $multi->resolveBooleanValue('beta-feature', false);
    
    $value = $result->getValue(); // either a resolved boolean or the default
    $error = $result->getError(); // null if success
    ```
    
    ## Follow-up improvements (non-blocking)
    
    - README section explaining multi-provider setup.
    
    ---------
    
    Signed-off-by: tmakinde <[email protected]>
    Tmakinde authored Jun 8, 2026
    Configuration menu
    Copy the full SHA
    145faf2 View commit details
    Browse the repository at this point in the history
  2. chore(main): release 2.2.0 (#176)

    🤖 I have created a release *beep* *boop*
    ---
    
    
    ##
    [2.2.0](2.1.2...2.2.0)
    (2026-06-08)
    
    
    ### ✨ New Features
    
    * Implement Multiprovider feature
    ([#159](#159))
    ([145faf2](145faf2))
    
    ---
    This PR was generated with [Release
    Please](https://github.com/googleapis/release-please). See
    [documentation](https://github.com/googleapis/release-please#release-please).
    
    Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
    github-actions[bot] authored Jun 8, 2026
    Configuration menu
    Copy the full SHA
    4063887 View commit details
    Browse the repository at this point in the history
Loading