transactions-php
Installation
SKILL.md
Transactions — PHP
Transactions are ACID, multi-document, and automatically retried on transient failures. The lambda may run more than once — keep it idempotent and free of side effects.
Version requirement: Distributed transactions require Couchbase Server 7.0+. The 6.6 developer preview is not recommended for production.
Basic Transaction
use Couchbase\TransactionAttemptContext;
use Couchbase\TransactionOptions;
use Couchbase\Exception\TransactionFailedException;
try {
$cluster->transactions()->run(function (TransactionAttemptContext $ctx) use ($collection) {
// Insert
$ctx->insert($collection, "doc-a", ["status" => "new"]);