Skip to content

Add PHP state management quickstart (http + sdk) - #1346

Open
hexmode wants to merge 2 commits into
dapr:masterfrom
hexmode:php-state-quickstart
Open

hexmode wants to merge 2 commits into
dapr:masterfrom
hexmode:php-state-quickstart

Conversation

@hexmode

@hexmode hexmode commented Sep 21, 2026

Copy link
Copy Markdown

Description

Adds state_management/php/sdk and state_management/php/http, mirroring the Python quickstart. A single order-processor PHP CLI app loops over orders, saving / getting / deleting each in the shared Redis statestore.

  • sdk — DaprClient::saveState(), getState(), deleteState()
  • http — raw POST/GET/DELETE /v1.0/state/statestore via curl (no SDK)

Both reuse the existing state_management/resources/ components, ship the standard dapr.yaml multi-app template, boilerplate makefile, and mechanical-markdown STEP blocks with deterministic output (Saving Order: {"orderId":"1"}, etc.). Apps are PHP CLI scripts (#!/usr/bin/env php), consistent with the pub/sub PHP quickstarts.

Dependencies / merge order

Stacked on #1342 (PHP CI wiring + pub_sub). Depends on the SDK fix dapr/php-sdk#154 (deleteState() currently fatals in published dev-main — see dapr/php-sdk#153).

Because published dev-main still has that bug, no composer.lock is committed for the sdk variant yet and its CI validation will fail until php-sdk#154 merges. Follow-up once it lands:

cd state_management/php/sdk
composer update dapr/php-sdk   # re-resolve dev-main with the fix
make validate                  # expect MAKE_EXIT=0
git add composer.lock && git commit -s -m "Add composer.lock for state management php sdk quickstart"
git push origin php-state-quickstart

The http variant has no third-party dependencies; its lock is committed and it validates as-is.

Issue reference

Fixes #1345

Checklist

  • The quickstart code compiles correctly
  • You've tested new builds of the quickstart if you changed quickstart code
  • You've updated the quickstart's README if necessary
  • Automated validation updated accordingly (STEP blocks mirror state_management/python/sdk)

Validation evidence: both variants pass make validate locally (Dapr 1.18.4 + state.redis). The sdk variant was validated against dapr/php-sdk@fix-delete-state-etag via a temporary composer path repository; MAKE_EXIT=0, all expected stdout lines matched, external links 200.

Add a PHP variant of the pub/sub quickstart alongside the existing
languages, with both an http (raw Dapr HTTP API) and an sdk
(dapr/php-sdk) flavor. Apps run as PHP CLI scripts; the subscriber
serves Dapr's HTTP callbacks via an embedded ReactPHP server.

Wire PHP into CI, the root makefile, and docs:
- .github/workflows/validate_php_quickstarts.yaml
- makefile: test_php_quickstarts target + test_all_quickstarts
- README.md: list test_php_quickstarts under validating
- .github/env/global.env: PHPVER
- .gitignore: vendor/, composer.phar

dapr/php-sdk is pinned to dev-main since the latest Packagist release
(v1.2.0) does not resolve on PHP 8.4; composer.lock pins the commit.
Both variants pass make validate locally.

Signed-off-by: Mark A. Hershberger <mah@nichework.com>
Add state_management/php/{sdk,http} mirroring the python quickstart: a
single order-processor CLI app that loops saving, getting, and deleting
order state in the shared redis statestore.

The sdk variant uses DaprClient saveState/getState/deleteState. The http
variant calls the raw /v1.0/state endpoints with curl.

Note: no composer.lock is committed for the sdk variant yet - published
dev-main of dapr/php-sdk has a deleteState TypeError bug, fixed in
php-sdk#154. Once that merges, generate and commit the lock. The http
variant has no third-party dependencies and is fully validated as-is.

Both variants pass make validate locally (sdk validated against
dapr/php-sdk@fix-delete-state-etag via a temporary path repository).

Signed-off-by: Mark A. Hershberger <mah@nichework.com>
@hexmode
hexmode requested review from a team as code owners September 21, 2026 02:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add PHP state management quickstart (http + sdk)

1 participant