durable-workflow/sample-app

Runnable PHP, Python, and Rust examples for Durable Workflow 2.0, including Laravel embedded mode.

39

stars

433

commits

PHP

primary language

Sep 10, 2026

updated

durable-workflow.com/docs/2.0/sample-app/
codespaces
durable-execution
durable-workflow
laravel
php
polyglot
python
rust
sample-application
workflow-engine
Browse cluster: Laravel PHP Web Applications

README

Durable Workflow Sample App

Application tests Embedded smoke Polyglot smoke Development image

Runnable examples for Durable Workflow 2.0. Start a PHP-authored workflow that calls Python and Rust activities through a standalone Server, build a workflow with any first-party SDK, or run the workflow engine inside Laravel.

Open in GitHub Codespaces

Choose a path

PathUse it whenCommand
Service modePHP, Python, and Rust workers share a standalone or managed runtimescripts/polyglot.sh
SDK playgroundYou want to author a small workflow and activity in one SDKscripts/playground php, python, or rust
Embedded LaravelLaravel owns workflow execution and storagecomposer run dev

The Codespaces image already contains PHP, Composer, Python, Rust, Cargo, Docker Compose, Node, Chromium, dw, and rg. Setup installs only this repository's Composer and npm dependencies.

Service mode

Run the featured PolyglotWorkflow:

scripts/polyglot.sh

The command starts a published Durable Workflow Server and three workers. A PHP workflow sends an order calculation to a Python activity, then sends that result to a Rust activity that produces a receipt. The final result identifies all three runtimes and the artifact versions used for the run.

The isolated sample-app-polyglot-demo Compose project remains available for inspection. Stop it with:

scripts/polyglot.sh down

See polyglot/README.md for the worker layout and the larger directional runtime matrix.

SDK playground

Use the same interface for each first-party SDK:

scripts/playground php
scripts/playground python
scripts/playground rust

Each command creates editable source under .playground/<language>, starts an isolated local Server and Waterline, waits for the worker registration, starts the workflow, verifies its result and history, and prints the matching Waterline run URL. Existing authored files are preserved.

Create a caller-owned project elsewhere with --source:

scripts/playground rust --source "$HOME/my-durable-rust-worker"

Inspect the effective contract without starting anything:

scripts/playground doctor
scripts/playground rust --print-contract

Remove one playground's containers and state with:

scripts/playground down rust

Managed runtime

The same authored project can run against Durable Workflow Cloud or another existing runtime. Supply role-specific credentials without putting them in source control:

export DURABLE_WORKFLOW_WORKER_TOKEN='<worker credential>'
export DURABLE_WORKFLOW_CLIENT_TOKEN='<client credential>'

scripts/playground rust \
  --runtime managed \
  --runtime-url 'https://runtime.example/namespaces/example' \
  --namespace 'example' \
  --task-queue 'my-rust-worker'

The worker receives only the worker credential, and the client receives only the client credential. The runner prints the workflow type, activity type, task queue, worker command, start command, and expected result before it runs.

Embedded Laravel

Start Laravel's web server, queue worker, logs, and Vite process:

composer run dev

In a second terminal, start the example workflow:

php artisan app:workflow

Open /waterline on the forwarded application URL to inspect the run. Run the Laravel workflow and activity tests with:

php artisan test

The embedded examples live under app/Workflows, with focused tests under tests/Feature/Workflows.

Example index

ExampleWhat it demonstrates
SimpleWorkflowMinimal embedded workflow and activity
AccountOnboardingWorkflowSignals, timers, and external interaction
BatchProcessingWorkflowBounded concurrency and fan-out
DataPipelineWorkflowMulti-step activity orchestration
DeployWorkflowChild workflows and deployment stages
SagaWorkflowCompensation after a failed step
SubscriptionWorkflowLong-running lifecycle and cancellation
SandboxAgentWorkflowDurable sandbox provisioning, snapshots, recovery, and cleanup
PolyglotWorkflowPHP workflow with Python and Rust activities

Repository map

PathPurpose
app/Workflows/Embedded Laravel examples
polyglot/Service-mode workers and Compose topology
playground/PHP, Python, and Rust authoring templates
scripts/polyglot.shFeatured PHP to Python to Rust run
scripts/playgroundSymmetric SDK authoring runner
.devcontainer/Prepared Codespaces development image

Local development

Codespaces is the shortest path. For an existing PHP 8.4, Node, Docker, and Docker Compose environment:

cp .env.example .env
composer install
npm install
php artisan key:generate
docker compose up -d
php artisan migrate
composer run dev

Run the focused checks with:

php artisan test
npm test
npm run build

Documentation

The Laravel 12 / Durable Workflow 1.x sample remains available on the Laravel-12 branch.

License

Durable Workflow Sample App is open source software licensed under the MIT license.

Contributors

rmcdaniel

112 commits

durable-workflow/sample-app

Runnable PHP, Python, and Rust examples for Durable Workflow 2.0, including Laravel embedded mode.

39

stars

433

commits

PHP

primary language

Sep 10, 2026

updated

durable-workflow.com/docs/2.0/sample-app/
codespaces
durable-execution
durable-workflow
laravel
php
polyglot
python
rust
sample-application
workflow-engine
Browse cluster: Laravel PHP Web Applications

README

Durable Workflow Sample App

Application tests Embedded smoke Polyglot smoke Development image

Runnable examples for Durable Workflow 2.0. Start a PHP-authored workflow that calls Python and Rust activities through a standalone Server, build a workflow with any first-party SDK, or run the workflow engine inside Laravel.

Open in GitHub Codespaces

Choose a path

PathUse it whenCommand
Service modePHP, Python, and Rust workers share a standalone or managed runtimescripts/polyglot.sh
SDK playgroundYou want to author a small workflow and activity in one SDKscripts/playground php, python, or rust
Embedded LaravelLaravel owns workflow execution and storagecomposer run dev

The Codespaces image already contains PHP, Composer, Python, Rust, Cargo, Docker Compose, Node, Chromium, dw, and rg. Setup installs only this repository's Composer and npm dependencies.

Service mode

Run the featured PolyglotWorkflow:

scripts/polyglot.sh

The command starts a published Durable Workflow Server and three workers. A PHP workflow sends an order calculation to a Python activity, then sends that result to a Rust activity that produces a receipt. The final result identifies all three runtimes and the artifact versions used for the run.

The isolated sample-app-polyglot-demo Compose project remains available for inspection. Stop it with:

scripts/polyglot.sh down

See polyglot/README.md for the worker layout and the larger directional runtime matrix.

SDK playground

Use the same interface for each first-party SDK:

scripts/playground php
scripts/playground python
scripts/playground rust

Each command creates editable source under .playground/<language>, starts an isolated local Server and Waterline, waits for the worker registration, starts the workflow, verifies its result and history, and prints the matching Waterline run URL. Existing authored files are preserved.

Create a caller-owned project elsewhere with --source:

scripts/playground rust --source "$HOME/my-durable-rust-worker"

Inspect the effective contract without starting anything:

scripts/playground doctor
scripts/playground rust --print-contract

Remove one playground's containers and state with:

scripts/playground down rust

Managed runtime

The same authored project can run against Durable Workflow Cloud or another existing runtime. Supply role-specific credentials without putting them in source control:

export DURABLE_WORKFLOW_WORKER_TOKEN='<worker credential>'
export DURABLE_WORKFLOW_CLIENT_TOKEN='<client credential>'

scripts/playground rust \
  --runtime managed \
  --runtime-url 'https://runtime.example/namespaces/example' \
  --namespace 'example' \
  --task-queue 'my-rust-worker'

The worker receives only the worker credential, and the client receives only the client credential. The runner prints the workflow type, activity type, task queue, worker command, start command, and expected result before it runs.

Embedded Laravel

Start Laravel's web server, queue worker, logs, and Vite process:

composer run dev

In a second terminal, start the example workflow:

php artisan app:workflow

Open /waterline on the forwarded application URL to inspect the run. Run the Laravel workflow and activity tests with:

php artisan test

The embedded examples live under app/Workflows, with focused tests under tests/Feature/Workflows.

Example index

ExampleWhat it demonstrates
SimpleWorkflowMinimal embedded workflow and activity
AccountOnboardingWorkflowSignals, timers, and external interaction
BatchProcessingWorkflowBounded concurrency and fan-out
DataPipelineWorkflowMulti-step activity orchestration
DeployWorkflowChild workflows and deployment stages
SagaWorkflowCompensation after a failed step
SubscriptionWorkflowLong-running lifecycle and cancellation
SandboxAgentWorkflowDurable sandbox provisioning, snapshots, recovery, and cleanup
PolyglotWorkflowPHP workflow with Python and Rust activities

Repository map

PathPurpose
app/Workflows/Embedded Laravel examples
polyglot/Service-mode workers and Compose topology
playground/PHP, Python, and Rust authoring templates
scripts/polyglot.shFeatured PHP to Python to Rust run
scripts/playgroundSymmetric SDK authoring runner
.devcontainer/Prepared Codespaces development image

Local development

Codespaces is the shortest path. For an existing PHP 8.4, Node, Docker, and Docker Compose environment:

cp .env.example .env
composer install
npm install
php artisan key:generate
docker compose up -d
php artisan migrate
composer run dev

Run the focused checks with:

php artisan test
npm test
npm run build

Documentation

The Laravel 12 / Durable Workflow 1.x sample remains available on the Laravel-12 branch.

License

Durable Workflow Sample App is open source software licensed under the MIT license.

Contributors

rmcdaniel

112 commits

Languages

PHP

56.6%

Python

19.3%

Blade

13.5%

Shell

4.7%

Rust

3.6%

Dockerfile

1.8%