Download the PHP package azaharizaman/nexus-idempotency without Composer
On this page you can find all versions of the php package azaharizaman/nexus-idempotency. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download azaharizaman/nexus-idempotency
More information about azaharizaman/nexus-idempotency
Files in azaharizaman/nexus-idempotency
Package nexus-idempotency
Short Description Domain-level idempotency: command deduplication and replay-safe results (Layer 1).
License MIT
Informations about the package nexus-idempotency
Nexus\Idempotency
Overview
Nexus\Idempotency is a Layer 1 package for command-level idempotency: deduplicate mutating operations using a tenant-scoped composite key (tenantId, operationRef, clientKey) plus a request fingerprint, and replay a stored opaque result for safe retries.
It does not implement HTTP, databases, outbox, event streams, or audit trails—see REQUIREMENTS.md for boundaries.
Architecture
- Layer 1: pure PHP 8.3+, framework-agnostic
- Explicit lifecycle:
begin()→ domain work →complete()orfail() - Persistence via
IdempotencyStoreInterface(composite ofIdempotencyQueryInterface+IdempotencyPersistInterface; e.g.InMemoryIdempotencyStorefor tests — uses JSON-encoded tuple keysjson_encode([tenantId, operationRef, clientKey])so segments cannot collide across delimiter characters) - Time via
IdempotencyClockInterface(SystemClockreturns UTCDateTimeImmutable, or test doubles)
Key interfaces
Nexus\Idempotency\Contracts\IdempotencyServiceInterfaceNexus\Idempotency\Contracts\IdempotencyStoreInterface(extends query + persist ports)Nexus\Idempotency\Contracts\IdempotencyClockInterface
Installation
From monorepo root:
Usage (conceptual)
complete() / fail() require the AttemptToken from the FirstExecution record for that attempt so completions cannot attach to a superseded reservation after TTL expiry/replace.
License
MIT