durable-workflow/workflow

Core package for defining and running durable workflows and activities. Supports long-running persistent workflows, retries, queues, parallel execution, workflow monitoring, dedicated storage connections, and orchestration for microservices, data pipelines, sagas, agentic workflows, and other complex business processes.

PHP

1,251

2,196 commits

updated Oct 16, 2026

See the code

README

Durable Workflow for Laravel

Build status Code coverage Latest Packagist version Packagist downloads MIT license

Durable Workflow is the embedded Laravel runtime for durable execution. Write long-running workflows as ordinary PHP, keep completed work recorded through worker restarts and application deploys, and use Laravel's queues, cache, and database as the runtime.

This package also provides the orchestration engine hosted by Durable Workflow Server. Use the PHP SDK with Server or Durable Workflow Cloud when workers need to run outside the Laravel application or across PHP, Python, and Rust.

Install

composer require durable-workflow/workflow:^2.0
php artisan migrate

For a new v2-only application, set DW_V1_ENABLED=false before the first migration. This omits the legacy v1 tables and queue watchdog. Existing applications keep v1 enabled by default so they can drain older work; do not disable it until that work is retired. Changing this setting does not drop existing tables.

Run a Laravel queue worker or Horizon to execute workflows and activities:

php artisan queue:work

Your First Workflow

<?php

use Workflow\V2\Activity;
use Workflow\V2\Workflow;
use Workflow\V2\WorkflowStub;
use function Workflow\V2\activity;

final class GreetActivity extends Activity
{
    public function handle(string $name): string
    {
        return "Hello, {$name}!";
    }
}

final class GreetWorkflow extends Workflow
{
    public function handle(string $name): string
    {
        return activity(GreetActivity::class, $name);
    }
}

$workflow = WorkflowStub::make(GreetWorkflow::class);
$workflow->start('world');

echo $workflow->output(); // Hello, world!

Workflow code can coordinate activities, timers, signals, queries, updates, child workflows, sagas, cancellation, retries, parallel work, side effects, continue-as-new, search attributes, memo, and message streams. The runtime persists execution history so replay can resume after process or host failure without repeating completed activities.

Schedule a Workflow

use Workflow\V2\Support\ScheduleManager;

$schedule = ScheduleManager::create(
    scheduleId: 'daily-greeting',
    workflowClass: GreetWorkflow::class,
    cronExpression: '0 9 * * *',
    arguments: ['world'],
    executionTimeoutSeconds: 120,
    runTimeoutSeconds: 60,
);

Run php artisan workflow:v2:schedule-tick from Laravel's scheduler to start due occurrences. Both scheduled occurrences and ScheduleManager::trigger() use these limits. The execution timeout covers one logical execution across retries and continue-as-new. The run timeout limits each individual run and resets on continue-as-new. Each occurrence starts a new execution budget. Omit either option, or pass null, to leave that limit unset.

See schedule timeout configuration for the action format, validation and updates.

Choose a Deployment

DeploymentUse it whenRuntime owner
Embedded LaravelWorkflows and activities live inside one Laravel application.Your application owns persistence and queue execution.
Self-hosted ServerWorkers run independently or in multiple languages.Your team operates Server, MySQL, Redis, and optional Waterline.
Durable Workflow CloudYou want a managed runtime for PHP, Python, and Rust workers.Durable Workflow operates the runtime and persistence.

Embedded runs remain owned by the Laravel application. Moving new work to Server or Cloud does not reinterpret existing embedded history.

Learn More

Questions and design discussions are welcome in GitHub Discussions and Discord.

Sponsors

Durable Workflow is sustained by contributors and sponsors:

background-jobs
bpm
bpmn
durable-execution
durable-functions
durable-workflow
jobs
laravel
microservices
orchestration
php
queueing
saga-pattern
workflow
workflow-automation
workflow-engine
workflows

durable-workflow/workflow

Core package for defining and running durable workflows and activities. Supports long-running persistent workflows, retries, queues, parallel execution, workflow monitoring, dedicated storage connections, and orchestration for microservices, data pipelines, sagas, agentic workflows, and other complex business processes.

PHP

1,251

2,196 commits

updated Oct 16, 2026

See the code

README

Durable Workflow for Laravel

Build status Code coverage Latest Packagist version Packagist downloads MIT license

Durable Workflow is the embedded Laravel runtime for durable execution. Write long-running workflows as ordinary PHP, keep completed work recorded through worker restarts and application deploys, and use Laravel's queues, cache, and database as the runtime.

This package also provides the orchestration engine hosted by Durable Workflow Server. Use the PHP SDK with Server or Durable Workflow Cloud when workers need to run outside the Laravel application or across PHP, Python, and Rust.

Install

composer require durable-workflow/workflow:^2.0
php artisan migrate

For a new v2-only application, set DW_V1_ENABLED=false before the first migration. This omits the legacy v1 tables and queue watchdog. Existing applications keep v1 enabled by default so they can drain older work; do not disable it until that work is retired. Changing this setting does not drop existing tables.

Run a Laravel queue worker or Horizon to execute workflows and activities:

php artisan queue:work

Your First Workflow

<?php

use Workflow\V2\Activity;
use Workflow\V2\Workflow;
use Workflow\V2\WorkflowStub;
use function Workflow\V2\activity;

final class GreetActivity extends Activity
{
    public function handle(string $name): string
    {
        return "Hello, {$name}!";
    }
}

final class GreetWorkflow extends Workflow
{
    public function handle(string $name): string
    {
        return activity(GreetActivity::class, $name);
    }
}

$workflow = WorkflowStub::make(GreetWorkflow::class);
$workflow->start('world');

echo $workflow->output(); // Hello, world!

Workflow code can coordinate activities, timers, signals, queries, updates, child workflows, sagas, cancellation, retries, parallel work, side effects, continue-as-new, search attributes, memo, and message streams. The runtime persists execution history so replay can resume after process or host failure without repeating completed activities.

Schedule a Workflow

use Workflow\V2\Support\ScheduleManager;

$schedule = ScheduleManager::create(
    scheduleId: 'daily-greeting',
    workflowClass: GreetWorkflow::class,
    cronExpression: '0 9 * * *',
    arguments: ['world'],
    executionTimeoutSeconds: 120,
    runTimeoutSeconds: 60,
);

Run php artisan workflow:v2:schedule-tick from Laravel's scheduler to start due occurrences. Both scheduled occurrences and ScheduleManager::trigger() use these limits. The execution timeout covers one logical execution across retries and continue-as-new. The run timeout limits each individual run and resets on continue-as-new. Each occurrence starts a new execution budget. Omit either option, or pass null, to leave that limit unset.

See schedule timeout configuration for the action format, validation and updates.

Choose a Deployment

DeploymentUse it whenRuntime owner
Embedded LaravelWorkflows and activities live inside one Laravel application.Your application owns persistence and queue execution.
Self-hosted ServerWorkers run independently or in multiple languages.Your team operates Server, MySQL, Redis, and optional Waterline.
Durable Workflow CloudYou want a managed runtime for PHP, Python, and Rust workers.Durable Workflow operates the runtime and persistence.

Embedded runs remain owned by the Laravel application. Moving new work to Server or Cloud does not reinterpret existing embedded history.

Learn More

Questions and design discussions are welcome in GitHub Discussions and Discord.

Sponsors

Durable Workflow is sustained by contributors and sponsors:

background-jobs
bpm
bpmn
durable-execution
durable-functions
durable-workflow
jobs
laravel
microservices
orchestration
php
queueing
saga-pattern
workflow
workflow-automation
workflow-engine
workflows

Significant stargazers

Chris

7,248 followers · starred Jan 2025

Amit Kumar

462 followers · starred Aug 2026

Brandon Surowiec

30 followers · starred Nov 2022

Sergej Oštir

9 followers · starred Dec 2022