Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Temporal PHP SDK

License

NotificationsYou must be signed in to change notification settings

temporalio/sdk-php

Repository files navigation

Temporal is a distributed, scalable, durable, and highly available orchestrationengine used to execute asynchronous long-running business logic in a scalableand resilient way.

Temporal PHP SDK is the framework for authoringWorkflows andActivities using PHP language.

Table of contents:

Get starting

Installation

Install the SDK using Composer:

composer require temporal/sdk

PHPStable ReleaseTotal DLoadsLicense

The SDK includes two main components:Clients and Workers.
The Clients component is used to start, schedule, and manage Workflows;the Workers component is used to execute Workflows and Activities.

The Clients component requires thegrpc extension,and the Workers component requiresRoadRunner.It's recommended to use both components with theprotobuf extensionin production to improve performance.

ClientWorker
RoadRunnerrequired
ext-grpcrequired
ext-protobufrecommendedrecommended

To download RoadRunner, you can use the following command:

./vendor/bin/rr get

Usage

If you are usingSpiral,follow theinstructions in the documentation.

If you are using the SDK without integrations, the following sections of the documentation may be helpful:

Note

Check outthe repository with examples of using the PHP SDK.

Warning

Since version2.11.0,feature flags were introducedthat change the behavior of the entire PHP worker.
It's recommended to disable deprecated behavior.

Testing

The PHP SDK includes a toolkit for testing Workflows.There isdocumentation anddev guide on how to test a Workflow using Activity mocking.

To ensure the determinism of a Workflow,you can also use theReplay API in tests.

Dev environment

Some recommendations for setting up a development environment:

Temporal CLI

TheTemporal CLI provides direct access to a Temporal Service via the terminal.You can use it to start, stop, inspect and operate on Workflows and Activities,and perform administrative tasks such as Namespace, Schedule, and Task Queue management.The Temporal CLI also includes an embedded Temporal Service suitable for use in development and CI/CD.It includes the Temporal Server, SQLite persistence, and the Temporal Web UI.

Run the following command to start the Temporal Service in development mode:

temporal server start-dev --log-level error

Experimental features:

  • Add flags--dynamic-config-value frontend.enableUpdateWorkflowExecution=true --dynamic-config-value frontend.enableUpdateWorkflowExecutionAsyncAccepted=trueto enable theWorkflow Update feature.
  • Add flag--dynamic-config-value frontend.enableExecuteMultiOperation=true to enableupdateWithStart() feature.
  • Add flag--dynamic-config-value system.enableEagerWorkflowStart=true to enable theEager Workflow Start feature.

Buggregator

During development, you might need to dump a variable, throw an error trace, or simply look at the call stack.Since Workflows and Activities run in RoadRunner workers, you cannot usevar_dump,print_r,echo, and other functions that output data to STDOUT.

Instead, useBuggregator along withTrap.In this case, dumps, traces, and logs will be sent via socket to your local Buggregator server,where you can view them in a convenient web interface.

Tip

Trap is a wrapper aroundsymfony/var-dumper, providing additional debugging capabilities.Moreover, Trap patches var-dumper for outputting protobuf structures, which is very handy when working with Temporal.

To run Buggregator in Docker, execute the command belowand follow theinstructions:

docker run --rm -p 8000:8000 -p 1025:1025 -p 9912:9912 -p 9913:9913 ghcr.io/buggregator/server:latest

If you are not using Docker or running PHP code outside a container, you can use Trap as a compact server:

./vendor/bin/trap --ui=8000

Now use thetrap(),tr(), ordump() functions to output data to Buggregator.Web UI will be available athttp://localhost:8000.

IDE Plugin

For advanced autocomplete while coding in PHPStorm, useMeta Storm plugin.The plugin provides better autocomplete and links Workflow and Activity when writing and debugging code.

Resources

Read the docs
Temporal DocumentationPHP SDK DocumentationPHP SDK API

Ask a question
Github issuesSlackForumDiscord

Stay tuned
Read BlogTemporal YT ChannelX

Additionally
Temporal communityAwesome Temporal

License

Temporal PHP SDK is open-sourced software licensed under theMIT license.

FOSSA Status


[8]ページ先頭

©2009-2025 Movatter.jp