Durable Workflow PHP SDK — API Reference

Guides

ExecutionTelemetry
in package

FinalYes

Optional execution instrumentation using application-owned OpenTelemetry providers.

Table of Contents

Constants

FIELDS  : mixed = ['workflow_instance_id', 'workflow_run_id', 'wo...
PACKAGE_NAME  : mixed = 'durable-workflow/sdk'

Properties

$applicationContext  : ContextInterface|null
$baggageAllowlist  : array<string|int, mixed>
$childProvider  : TracerProviderInterface|null
$childProviderFactory  : Closure|null
$childProviderPid  : int|null
$enabled  : bool
$fibers  : WeakMap<object, int>|null
$key  : ContextKeyInterface<string|int, array<string, string|int>>|null
$ownerPid  : int
$provider  : TracerProviderInterface|null

Methods

__construct()  : mixed
A cooperative callback must create its own provider after fork. Use a synchronous processor and bounded exporter: child shutdown hooks do not run.
activity()  : mixed
bind()  : callable
Bind only SDK-created workflow Fibers; unrelated Fibers inherit no durable identities.
capture()  : array<string, mixed>|null
Capture the actual caller before HTTP transport, using the app's propagators.
current()  : array<string, string|int>
failure()  : void
Record a failure already classified by the worker, without exception messages or stack arguments.
task()  : mixed
Uses only existing poll identities. Durable wire carriers are not adopted here.
taskFields()  : array<string|int, mixed>
childTracerProvider()  : TracerProviderInterface
close()  : void
enterFiber()  : void
fields()  : array<string|int, mixed>
observeDispatch()  : void
observeLinks()  : void
observeTask()  : ContextInterface
open()  : ScopeInterface}|null
run()  : mixed

Constants

FIELDS

private mixed FIELDS = ['workflow_instance_id', 'workflow_run_id', 'workflow_type', 'namespace', 'task_id', 'activity_id', 'activity_type', 'activity_attempt_id', 'activity_attempt_number', 'request_id', 'task_queue']

Properties

$key

private static ContextKeyInterface<string|int, array<string, string|int>>|null $key = null

Methods

__construct()

A cooperative callback must create its own provider after fork. Use a synchronous processor and bounded exporter: child shutdown hooks do not run.

public __construct([TracerProviderInterface|null $tracerProvider = null ][, bool $enabled = true ][, callable(): TracerProviderInterface|null $childProviderFactory = null ][, array<int, string> $baggageAllowlist = [] ]) : mixed

Without a factory, child tracing is disabled rather than reusing sockets.

Parameters
$tracerProvider : TracerProviderInterface|null = null
$enabled : bool = true
$childProviderFactory : callable(): TracerProviderInterface|null = null
$baggageAllowlist : array<int, string> = []

activity()

public activity(array<string, mixed> $fields, callable $operation[, bool $local = false ]) : mixed
Parameters
$fields : array<string, mixed>
$operation : callable
$local : bool = false

bind()

Bind only SDK-created workflow Fibers; unrelated Fibers inherit no durable identities.

public static bind(callable $operation) : callable
Parameters
$operation : callable
Return values
callable

capture()

Capture the actual caller before HTTP transport, using the app's propagators.

public capture() : array<string, mixed>|null
Return values
array<string, mixed>|null

current()

public static current() : array<string, string|int>
Return values
array<string, string|int>

failure()

Record a failure already classified by the worker, without exception messages or stack arguments.

public static failure(Throwable $failure) : void
Parameters
$failure : Throwable

task()

Uses only existing poll identities. Durable wire carriers are not adopted here.

public task(string $kind, array<string, mixed> $task, string $namespace, string $queue, callable $operation) : mixed
Parameters
$kind : string
$task : array<string, mixed>
$namespace : string
$queue : string
$operation : callable

taskFields()

public static taskFields(array<string, mixed> $task, string $namespace, string $queue) : array<string|int, mixed>
Parameters
$task : array<string, mixed>

@return array<string, mixed>

$namespace : string
$queue : string
Return values
array<string|int, mixed>

childTracerProvider()

private childTracerProvider() : TracerProviderInterface
Return values
TracerProviderInterface

close()

private static close(ScopeInterface|null $scope, SpanInterface|null $span) : void
Parameters
$scope : ScopeInterface|null
$span : SpanInterface|null

fields()

private static fields(array<string, mixed> $attributes) : array<string|int, mixed>
Parameters
$attributes : array<string, mixed>

@return array<string, string|int>

Return values
array<string|int, mixed>

observeDispatch()

private observeDispatch(SpanBuilderInterface $builder, array<string, mixed> $wireTask, string $taskId) : void
Parameters
$builder : SpanBuilderInterface
$wireTask : array<string, mixed>
$taskId : string
private observeLinks(SpanBuilderInterface $builder, array<string, mixed> $wireTask, array<string|int, mixed> $attributes, string $taskId) : void
Parameters
$builder : SpanBuilderInterface
$wireTask : array<string, mixed>

@param array<string, mixed> $attributes

$attributes : array<string|int, mixed>
$taskId : string

observeTask()

private observeTask(SpanBuilderInterface $builder, ContextInterface $parent, array<string, mixed> $wireTask, array<string|int, mixed> $attributes) : ContextInterface
Parameters
$builder : SpanBuilderInterface
$parent : ContextInterface
$wireTask : array<string, mixed>

@param array<string, mixed> $attributes

$attributes : array<string|int, mixed>
Return values
ContextInterface

open()

private open(string $name, array<string, mixed> $attributes, bool $inherit[, array<string, mixed>|null $wireTask = null ]) : ScopeInterface}|null
Parameters
$name : string
$attributes : array<string, mixed>
$inherit : bool
$wireTask : array<string, mixed>|null = null
Return values
ScopeInterface}|null

run()

private run(string $name, array<string, mixed> $attributes, callable $operation[, bool $inherit = false ]) : mixed
Parameters
$name : string
$attributes : array<string, mixed>
$operation : callable
$inherit : bool = false
On this page

Search results