PHPackages                             yedf/dtmcli-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. yedf/dtmcli-php

ActiveLibrary[Database &amp; ORM](/categories/database)

yedf/dtmcli-php
===============

331888[1 issues](https://github.com/yedf/dtmcli-php/issues)PHP

Since Nov 14Pushed 4y ago8 watchersCompare

[ Source](https://github.com/yedf/dtmcli-php)[ Packagist](https://packagist.org/packages/yedf/dtmcli-php)[ RSS](/packages/yedf-dtmcli-php/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

a client for distributed transaction manager [dtm](https://github.com/yedf/dtm)

`dtmcli` 是分布式事务管理器[dtm](https://github.com/yedf/dtm)的客户端sdk

dtm分布式事务管理服务
------------

[](#dtm分布式事务管理服务)

DTM是一款跨语言的开源分布式事务管理器，优雅的解决了幂等、空补偿、悬挂等分布式事务难题。提供了简单易用、高性能、易水平扩展的分布式事务解决方案。

亮点
--

[](#亮点)

- 极易接入
    - 支持HTTP，提供非常简单的接口，极大降低上手分布式事务的难度，新手也能快速接入
- 使用简单
    - 开发者不再担心悬挂、空补偿、幂等各类问题，框架层代为处理
- 跨语言
    - 可适合多语言栈的公司使用。方便go、python、php、nodejs、ruby各类语言使用。
- 易部署、易扩展
    - 仅依赖mysql，部署简单，易集群化，易水平扩展
- 多种分布式事务协议支持
    - TCC、SAGA、XA、事务消息

与其他框架对比
-------

[](#与其他框架对比)

目前开源的分布式事务框架，暂未看到非Java语言有成熟的框架。而Java语言的较多，有阿里的SEATA、华为的ServiceComb-Pack，京东的shardingsphere，以及himly，tcc-transaction，ByteTCC等等，其中以seata应用最为广泛。

下面是dtm和seata的主要特性对比：

特性DTMSEATA备注支持语言Golang、python、php及其他Javadtm可轻松接入一门新语言异常处理[子事务屏障自动处理](https://zhuanlan.zhihu.com/p/388444465)手动处理dtm解决了幂等、悬挂、空补偿TCC事务✓✓XA事务✓✓AT事务✗✓AT与XA类似，性能更好，但有脏回滚SAGA事务简单模式状态机复杂模式dtm的状态机模式在规划中事务消息✓✗dtm提供类似rocketmq的事务消息通信协议HTTPdubbo等协议，无HTTPdtm后续将支持grpc类协议star数量[![github stars](https://camo.githubusercontent.com/b024c075b9ff12d1642886871e8e44fd9d44be049be48999351a2b0a05ae3e95/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f796564662f64746d2e7376673f7374796c653d736f6369616c)](https://camo.githubusercontent.com/b024c075b9ff12d1642886871e8e44fd9d44be049be48999351a2b0a05ae3e95/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f796564662f64746d2e7376673f7374796c653d736f6369616c)[![github stars](https://camo.githubusercontent.com/5819e318ba7b39b32bc332a1bd00b2c1d490461ab5bccaa47cca38c55305895c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f73656174612f73656174612e7376673f7374796c653d736f6369616c)](https://camo.githubusercontent.com/5819e318ba7b39b32bc332a1bd00b2c1d490461ab5bccaa47cca38c55305895c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f73656174612f73656174612e7376673f7374796c653d736f6369616c)dtm从20210604发布0.1，发展快从上面对比的特性来看，如果您的语言栈包含了Java之外的语言，那么dtm是您的首选。如果您的语言栈是Java，您也可以选择接入dtm，使用子事务屏障技术，简化您的业务编写。

使用示例
----

[](#使用示例)

```
composer require yedf/dtmcli-php:dev-main

```

```
function FireTcc () {
    $dtm = 'http://192.168.69.128:8080/api/dtmsvr';
    $svc = 'http://192.168.69.128:4005/api';

    Dtmcli\tccGlobalTransaction($dtm, function ($tcc) use ($svc) {
        /** @var Dtmcli\Tcc $tcc */

        $req = ['amount' => 30];
        echo 'calling trans out' . PHP_EOL;
        $tcc->callBranch($req, $svc . '/TransOutTry', $svc . '/TransOutConfirm', $svc . '/TransOutCancel');
        echo 'calling trans in' . PHP_EOL;
        $tcc->callBranch($req, $svc . '/TransInTry', $svc . '/TransInConfirm', $svc . '/TransInCancel');
    });
}
```

可运行的使用示例
========

[](#可运行的使用示例)

见

特别说明
====

[](#特别说明)

使用[mix/guzzle](https://github.com/mix-php/guzzle)为http客户端，支持swoole协程请求

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity28

Early-stage or recently created project

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/30f40c2b0d3b551ae17d4278adc8a0a177c0c3cec13b965c0968ea2dfe4abb41?d=identicon)[onlyshow](/maintainers/onlyshow)

---

Top Contributors

[![onlyshow](https://avatars.githubusercontent.com/u/12505832?v=4)](https://github.com/onlyshow "onlyshow (4 commits)")[![dongfuye](https://avatars.githubusercontent.com/u/118151011?v=4)](https://github.com/dongfuye "dongfuye (2 commits)")[![haveatest2016](https://avatars.githubusercontent.com/u/20514824?v=4)](https://github.com/haveatest2016 "haveatest2016 (2 commits)")[![yedf2](https://avatars.githubusercontent.com/u/43027375?v=4)](https://github.com/yedf2 "yedf2 (1 commits)")

---

Tags

databasedistributeddistributed-transactionshttpmicroservicephpsagaseatatcctransaction

### Embed Badge

![Health badge](/badges/yedf-dtmcli-php/health.svg)

```
[![Health](https://phpackages.com/badges/yedf-dtmcli-php/health.svg)](https://phpackages.com/packages/yedf-dtmcli-php)
```

###  Alternatives

[doctrine/orm

Object-Relational-Mapper for PHP

10.2k285.3M6.2k](/packages/doctrine-orm)[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k115.1M102](/packages/jdorn-sql-formatter)[illuminate/database

The Illuminate Database package.

2.8k52.4M9.4k](/packages/illuminate-database)[ramsey/uuid-doctrine

Use ramsey/uuid as a Doctrine field type.

90440.3M211](/packages/ramsey-uuid-doctrine)[reliese/laravel

Reliese Components for Laravel Framework code generation.

1.7k3.4M16](/packages/reliese-laravel)[wildside/userstamps

Laravel Userstamps provides an Eloquent trait which automatically maintains `created\_by` and `updated\_by` columns on your model, populated by the currently authenticated user in your application.

7511.7M13](/packages/wildside-userstamps)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
