temporal/sdk 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

temporal/sdk

Composer 安装命令:

composer require temporal/sdk

包简介

Temporal SDK

README 文档

README

Temporal PHP SDK

Temporal PHP SDK

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

Temporal PHP SDK is the framework for authoring Workflows and Activities using PHP language.

Table of contents:

Get starting

Installation

Install the SDK using Composer:

composer require temporal/sdk

PHP Stable Release Total DLoads License

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 the grpc extension, and the Workers component requires RoadRunner. It's recommended to use both components with the protobuf extension in production to improve performance.

Client Worker
RoadRunner required
ext-grpc required
ext-protobuf recommended recommended

To download RoadRunner, you can use the following command:

./vendor/bin/rr get

Usage

If you are using Spiral, follow the instructions in the documentation.

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

Note

Check out the repository with examples of using the PHP SDK.

Warning

Since version 2.11.0, feature flags were introduced that 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 is documentation and dev guide on how to test a Workflow using Activity mocking.

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

Dev environment

Some recommendations for setting up a development environment:

Temporal CLI

The Temporal 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=true to enable the Workflow Update feature.
  • Add flag --dynamic-config-value frontend.enableExecuteMultiOperation=true to enable updateWithStart() feature.
  • Add flag --dynamic-config-value system.enableEagerWorkflowStart=true to enable the Eager 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 use var_dump, print_r, echo, and other functions that output data to STDOUT.

Instead, use Buggregator along with Trap. 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 around symfony/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 below and follow the instructions:

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 the trap(), tr(), or dump() functions to output data to Buggregator. Web UI will be available at http://localhost:8000.

IDE Plugin

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

Contibuting

We'd love your help improving the Temporal PHP SDK. Please review our contribution guidelines.

Resources

Read the docs
Temporal Documentation PHP SDK Documentation PHP SDK API

Ask a question
Github issues Slack Forum Discord

Stay tuned
Read Blog Temporal YT Channel X

Additionally
Temporal community Awesome Temporal

License

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

FOSSA Status

temporal/sdk 适用场景与选型建议

temporal/sdk 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2.96M 次下载、GitHub Stars 达 410, 最近一次更新时间为 2020 年 11 月 24 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「api」 「library」 「workflow」 「sdk」 「activity」 「temporal」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 temporal/sdk 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 temporal/sdk 我们能提供哪些服务?
定制开发 / 二次开发

基于 temporal/sdk 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 2.96M
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 410
  • 点击次数: 24
  • 依赖项目数: 21
  • 推荐数: 3

GitHub 信息

  • Stars: 410
  • Watchers: 14
  • Forks: 60
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-11-24