Conversation
Implement the Dapr Configuration building block over HTTP: - DaprClient::getConfiguration() / getConfigurationAsync() — read items from a configuration store (GET /v1.0/configuration/<store>), returning a map of key => ConfigurationItem. - DaprClient::subscribeConfiguration() / subscribeConfigurationAsync() — subscribe to changes (GET /v1.0/configuration/<store>/subscribe), returning the subscription id. - DaprClient::unsubscribeConfiguration() / unsubscribeConfigurationAsync() — unsubscribe (GET /v1.0/configuration/<store>/<id>/unsubscribe). - Configuration\ConfigurationItem value object (value/version/metadata). - Configuration\ConfigurationUpdate::parse() to decode the update payload the sidecar POSTs to the app's /configuration/<store> route. Keys are sent as repeated 'key=' query params (built manually since Dapr does not accept PHP's key[0]= encoding). ConfigurationItem uses plain property defaults rather than constructor promotion because the deserializer instantiates it without the constructor and stores may omit version/metadata. Adds HttpConfigurationTrait, wires it into DaprHttpClient, declares the abstract methods on DaprClient, covers it with 8 unit tests, and documents it in the readme. Verified end-to-end against a live sidecar with the configuration.redis store (get, subscribe, pushed update, unsubscribe). Signed-off-by: Mark A. Hershberger <mah@nichework.com>
Signed-off-by: Mark A. Hershberger <mah@nichework.com>
This was referenced Sep 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds the Configuration API building block to the HTTP client:
DaprClient::getConfiguration()/getConfigurationAsync()— read items from a configuration store (GET /v1.0/configuration/<store>), returningarray<string, ConfigurationItem>DaprClient::subscribeConfiguration()/subscribeConfigurationAsync()— subscribe to changes (GET /v1.0/configuration/<store>/subscribe), returning the subscription idDaprClient::unsubscribeConfiguration()/unsubscribeConfigurationAsync()— unsubscribe (GET /v1.0/configuration/<store>/<id>/unsubscribe)Configuration\ConfigurationItem— value object (value/version/metadata)Configuration\ConfigurationUpdate::parse()— decodes the update payload the sidecar POSTs to the app's/configuration/<store>routeImplementation notes:
key=query parameters (the query string is built manually because Dapr does not accept PHP's defaultkey[0]=array encoding).ConfigurationItemuses plain property defaults rather than constructor promotion: the deserializer instantiates it vianewInstanceWithoutConstructor(), and stores such asconfiguration.redisomitversion/metadata— with promoted defaults this fatally errors ("must not be accessed before initialization"). There is a regression test for this case.Issue reference
Fixes #151
Checklist
tests/ConfigurationTest.phpcovering request shape (URI/query/method), response mapping, sparse items, unsubscribe failure, and update parsingreadme.md("Accessing Configuration") and a newdaprdocs/content/en/php-sdk-docs/php-configuration.mdpageAdditionally verified end-to-end against a live sidecar (Dapr 1.18.4) with a
configuration.redisstore: get → subscribe → pushed update afterMSET→ unsubscribe.