Skip to main content
Version: 2.0

Durable Workflow 2.0 Quickstart

Before you begin

Goal: run one service-mode workflow and read its completed durable result from PHP, Python, or Rust.

Expected time: about 15 minutes after your runtime is available.

Completed outcome: the selected SDK starts a worker and workflow, then prints a workflow ID, status=completed, and Hello, <language>!.

Prerequisites:

  • curl and a terminal
  • Docker for the self-hosted local path, or a provisioned Durable Workflow Cloud namespace
  • one language toolchain: PHP 8.1+ with Composer, Python 3.10+, or Rust 1.86+

You do not need Laravel for service mode. The embedded Laravel path is separate at the end of this guide.

1. Choose your service-mode runtime

RuntimeChoose it whenNext action
Durable Workflow CloudYou want Durable Workflow to operate the runtime, persistence, and Managed Waterline.Follow the executable Cloud first workflow, which maps PHP, Python, and Rust complete sources to provisioned credentials and a completed result. Do not run Server or a separate Waterline service.
Self-hosted ServerYou want to operate the runtime yourself or run this exact local published-artifact exercise.Continue below with Docker and curl; deploy Waterline separately only when you want its operator UI.

The runnable source below uses a local self-hosted Server so it can be exercised without an account or source checkout. Cloud uses the same SDK and worker model; replace the local development connection with the provisioned values shown in Cloud Managed Runtime.

2. Start the local Server

Skip this action when you chose Cloud. For the self-hosted path, expand and run the exact pinned setup. It starts a source-free Server with SQLite and a development token.

Start the pinned Server image
export DW_SERVER_IMAGE=durableworkflow/server:2.0.0
export DW_AUTH_TOKEN=dev-token

docker volume create durable-workflow-quickstart

docker run --rm \
-v durable-workflow-quickstart:/app/database \
-e DW_AUTH_DRIVER=token \
-e DW_AUTH_TOKEN="$DW_AUTH_TOKEN" \
"$DW_SERVER_IMAGE" server-bootstrap

docker rm -f durable-workflow-server >/dev/null 2>&1 || true
docker run -d --name durable-workflow-server \
-p 8080:8080 \
-v durable-workflow-quickstart:/app/database \
-e DW_AUTH_DRIVER=token \
-e DW_AUTH_TOKEN="$DW_AUTH_TOKEN" \
"$DW_SERVER_IMAGE"

until curl -sf http://localhost:8080/api/ready >/dev/null; do sleep 1; done
curl -H "Authorization: Bearer $DW_AUTH_TOKEN" \
http://localhost:8080/api/cluster/info

Expected result: the readiness request succeeds and cluster info identifies the local standalone Server. Keep it running while you complete one language route.

3. Choose one language

All three first-party SDKs are available at the same level. Only the selected tab is shown, so you can follow one path without scrolling past two other programs.

Requirements: PHP 8.1 or newer and Composer. This is the framework-neutral durable-workflow/sdk package, not the embedded Laravel engine.

  1. Install the SDK.
mkdir durable-workflow-php-quickstart
cd durable-workflow-php-quickstart
composer require durable-workflow/sdk:2.0.0
  1. Add the worker and client. Expand the complete source, then copy both files into the new project.
Complete runnable PHP source

The worker registers one workflow type and one activity type on its own task queue.

cat > worker.php <<'PHP'
<?php

declare(strict_types=1);

require __DIR__.'/vendor/autoload.php';

use DurableWorkflow\Client;
use DurableWorkflow\Worker;
use DurableWorkflow\Worker\ActivityContext;
use DurableWorkflow\Worker\WorkflowContext;

$client = new Client('http://localhost:8080', token: 'dev-token');
$worker = new Worker($client, 'quickstart-php');

$worker->registerActivity(
'quickstart.greet',
static fn (ActivityContext $context, string $name): string => "Hello, {$name}!",
);

$worker->registerWorkflow(
'quickstart.greeter',
static function (WorkflowContext $context, string $name): array {
$greeting = $context->activity('quickstart.greet', [$name]);

return ['greeting' => $greeting, 'language' => 'php'];
},
);

$worker->run();
PHP

Client and result reader

This client starts a uniquely named workflow, waits for its selected run, and then describes the durable terminal state held by the server.

cat > start.php <<'PHP'
<?php

declare(strict_types=1);

require __DIR__.'/vendor/autoload.php';

use DurableWorkflow\Client;

$client = new Client('http://localhost:8080', token: 'dev-token');
$workflowId = 'quickstart-php-greeter-'.bin2hex(random_bytes(4));
$handle = $client->startWorkflow(
workflowType: 'quickstart.greeter',
workflowId: $workflowId,
taskQueue: 'quickstart-php',
input: ['PHP'],
);

$result = $handle->result(timeoutSeconds: 30);
$execution = $handle->describeSelectedRun();

echo "workflow_id={$execution->workflowId}\n";
echo "status={$execution->status}\n";
echo 'result='.json_encode($result, JSON_THROW_ON_ERROR)."\n";
PHP
  1. Run the worker and client.
php worker.php > quickstart-worker.log 2>&1 &
export QUICKSTART_WORKER_PID=$!
trap 'kill "$QUICKSTART_WORKER_PID" 2>/dev/null || true' EXIT

php start.php

kill "$QUICKSTART_WORKER_PID" 2>/dev/null || true
trap - EXIT

Expected result: status=completed and a result containing "greeting":"Hello, PHP!". You have run a standalone PHP worker and inspected its durable result without Laravel.

Continue with the PHP SDK guide.

4. Clean up the local Server

Cloud users have no local Server to remove. For the self-hosted exercise:

docker rm -f durable-workflow-server
docker volume rm durable-workflow-quickstart

Separate path: embedded Laravel

Embedded Laravel is a separate first-party PHP deployment mode for applications that want workflow state, queue execution, configuration, and operator tooling inside their existing Laravel infrastructure. It installs durable-workflow/workflow; it does not use the standalone server or durable-workflow/sdk.

Start a fresh embedded application with the published package:

composer create-project laravel/laravel durable-workflow-laravel-quickstart
cd durable-workflow-laravel-quickstart
composer require durable-workflow/workflow:2.0.1
php artisan migrate
php artisan queue:work

When you want the operator UI inside that same Laravel application, add the qualified embedded Waterline Composer package:

composer require durable-workflow/waterline:2.0.0
php artisan waterline:install

This Composer package is not the install identity for the separately deployed self-hosted Waterline service. Embedded Laravel does not run Server or install one of the service-mode SDKs.

Continue with Embedded Installation to configure a non-sync Laravel queue, then define and start an embedded workflow. Deployment Modes compares this specialized route with the service-mode platform.

Next steps

For embedded Laravel authoring features such as timers, signals, queries, activities, and child workflows, use the separate Embedded documentation.

Release qualification is intentionally separate from this first-success guide. The Platform Conformance Suite contains the exact artifact matrix, public-source checks, full execution transcripts, wall-clock criteria, teardown, and machine-readable quickstart contract used for certification.