php-sdk icon indicating copy to clipboard operation
php-sdk copied to clipboard

feat: Implement Multiprovider feature

Open Tmakinde opened this issue 1 month ago • 6 comments

Task

Multiprovider feature: https://openfeature.dev/specification/appendix-a#multi-provider

Tmakinde avatar Sep 30 '25 13:09 Tmakinde

Summary of Changes

Hello @Tmakinde, I'm Gemini Code Assist[^1]! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request establishes the foundational Multiprovider class, which is crucial for handling multiple feature flag providers. It focuses on robust input validation and systematic registration of providers, ensuring data integrity and preventing naming conflicts, thereby setting the stage for advanced multiprovider capabilities.

Highlights

  • New Multiprovider Class: Introduced a new Multiprovider class to manage multiple feature flag providers, aligning with the OpenFeature multiprovider specification.
  • Provider Data Validation: Implemented validateProviderData to ensure provider input arrays contain only supported keys, have non-empty names, and prevent duplicate explicit provider names.
  • Provider Registration and Unique Naming: Developed registerProviders and uniqueProviderName methods to register providers by name, automatically generating unique names for providers that are unnamed or have conflicting names by appending a numerical suffix.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with :thumbsup: and :thumbsdown: on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

[^1]: Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

gemini-code-assist[bot] avatar Sep 30 '25 13:09 gemini-code-assist[bot]

Hey @Tmakinde , initial thoughts here is that other languages utilized the contrib repository for implementing the multi provider. The reasoning as I understand it is it's an extension of the primary provider, not a function of it itself.

That said it would be fairly straightforward to add support for it there

@beeme1mr is that the expectation for all languages?

tcarrio avatar Sep 30 '25 14:09 tcarrio

Hey @Tmakinde , initial thoughts here is that other languages utilized the contrib repository for implementing the multi provider. The reasoning as I understand it is it's an extension of the primary provider, not a function of it itself.

That said it would be fairly straightforward to add support for it there

@beeme1mr is that the expectation for all languages?

Ooh.

Please let me know the best place to implement this. @beeme1mr told me it should be in php-sdk repo.

Please confirm.

Tmakinde avatar Sep 30 '25 14:09 Tmakinde

We've been slowly moving the multi-providers to the SDKs themselves. The logic being that it's easier to access and manage provider state from within the SDK and it shouldn't add too much complexity to the SDKs. The .NET SDK is a good example of what we're looking for.

beeme1mr avatar Sep 30 '25 15:09 beeme1mr

We've been slowly moving the multi-providers to the SDKs themselves. The logic being that it's easier to access and manage provider state from within the SDK and it shouldn't add too much complexity to the SDKs. The .NET SDK is a good example of what we're looking for.

Thank you @beeme1mr

Tmakinde avatar Sep 30 '25 16:09 Tmakinde

Codecov Report

:x: Patch coverage is 95.30686% with 13 lines in your changes missing coverage. Please review. :white_check_mark: Project coverage is 96.23%. Comparing base (2123274) to head (418f73a). :warning: Report is 24 commits behind head on main.

Files with missing lines Patch % Lines
...tiprovider/strategy/StrategyPerProviderContext.php 60.00% 4 Missing :warning:
src/implementation/multiprovider/Multiprovider.php 97.14% 3 Missing :warning:
...tion/multiprovider/strategy/ComparisonStrategy.php 95.00% 3 Missing :warning:
.../multiprovider/strategy/BaseEvaluationStrategy.php 0.00% 2 Missing :warning:
...tion/multiprovider/strategy/FirstMatchStrategy.php 97.82% 1 Missing :warning:
Additional details and impacted files
@@             Coverage Diff              @@
##               main     #159      +/-   ##
============================================
+ Coverage     95.19%   96.23%   +1.03%     
- Complexity      227      343     +116     
============================================
  Files            40       49       +9     
  Lines           583      850     +267     
============================================
+ Hits            555      818     +263     
- Misses           28       32       +4     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov[bot] avatar Oct 22 '25 09:10 codecov[bot]