open-feature / open-feature/php-sdk
[FEATURE] expose flags metadata as per OpenFeature specification
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 43
- Forks
- 14
- Avg merge
- 4d 12h
- Merged PRs (30d)
- 4
Description
Requirements
Requirements
Summary
The SDK should expose the Flags Metadata to the client through EvaluationDetails and ResolutionDetails models, to align with OpenFeature Specification Requirement 1.4.14 and Requirement 2.2.9/2.2.10
Motivation
Currently, the SDK is missing the flag's metadata property in EvaluationDetails and ResolutionDetails, in the same way the setter for flag's metadata is missing in the builders EvaluationDetailsBuilderand ResolutionDetailsBuilder. Other SDKs are already aligned with the current OpenFeature Specification regarding flag's metadata and this one should follow the path of alignment with current specifications.
Proposed solution
- Add the
getMetadata()method into theEvaluationDetailsandResolutionDetailsinterfaces. - Add the
withMetadata()method into theEvaluationDetailsBuilderandResolutionDetailsBuilderbuilders. - Update any other codebase if needed.
Impact on current adoption
This is an additive change and current adoption from clients should be uneffected.
Open Questions
Should this be considered major update or minor update? PHP seems to not support default implementation for interface methods, this means that any possible external implementation of EvaluationDetails and ResolutionDetails may break on current adoption, anyway it's possible that other repos and projects directly use the implementation or the builders and going to minor update would be possible. With the current proposed approach I'd go for not breaking changes if possible, staying on minor update, if someone has other ideas or feedback you're welcome to share 🙏.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with src/interfaces/flags/EvaluationDetails.php and src/interfaces/provider/ResolutionDetails.php, then inspect the corresponding EvaluationDetailsBuilder.php and ResolutionDetailsBuilder.php files. Trace their usages and existing tests, and compare the requested methods with the linked OpenFeature requirements. Done means metadata is exposed consistently while the compatibility impact of changing the interfaces is understood.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend-api-design
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 62/100