## 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]>