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.
| Path | Use it when | Command |
|---|---|---|
| Service mode | PHP, Python, and Rust workers share a standalone or managed runtime | scripts/polyglot.sh |
| SDK playground | You want to author a small workflow and activity in one SDK | scripts/playground php, python, or rust |
| Embedded Laravel | Laravel owns workflow execution and storage | composer 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.
Run the featured PolyglotWorkflow:
scripts/polyglot.shThe 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 downSee polyglot/README.md for the worker layout and the larger directional runtime matrix.
Use the same interface for each first-party SDK:
scripts/playground php
scripts/playground python
scripts/playground rustEach 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-contractRemove one playground's containers and state with:
scripts/playground down rustThe 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.
Start Laravel's web server, queue worker, logs, and Vite process:
composer run devIn a second terminal, start the example workflow:
php artisan app:workflowOpen /waterline on the forwarded application URL to inspect the run. Run the
Laravel workflow and activity tests with:
php artisan testThe embedded examples live under app/Workflows, with focused tests under tests/Feature/Workflows.
| Example | What it demonstrates |
|---|---|
SimpleWorkflow |
Minimal embedded workflow and activity |
AccountOnboardingWorkflow |
Signals, timers, and external interaction |
BatchProcessingWorkflow |
Bounded concurrency and fan-out |
DataPipelineWorkflow |
Multi-step activity orchestration |
DeployWorkflow |
Child workflows and deployment stages |
SagaWorkflow |
Compensation after a failed step |
SubscriptionWorkflow |
Long-running lifecycle and cancellation |
SandboxAgentWorkflow |
Durable sandbox provisioning, snapshots, recovery, and cleanup |
PolyglotWorkflow |
PHP workflow with Python and Rust activities |
| Path | Purpose |
|---|---|
app/Workflows/ |
Embedded Laravel examples |
polyglot/ |
Service-mode workers and Compose topology |
playground/ |
PHP, Python, and Rust authoring templates |
scripts/polyglot.sh |
Featured PHP to Python to Rust run |
scripts/playground |
Symmetric SDK authoring runner |
.devcontainer/ |
Prepared Codespaces development image |
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 devRun the focused checks with:
php artisan test
npm test
npm run buildThe Laravel 12 / Durable Workflow 1.x sample remains available on the
Laravel-12 branch.
Durable Workflow Sample App is open source software licensed under the MIT license.