PHPackages                             azaharizaman/nexus-outbox - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. azaharizaman/nexus-outbox

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

azaharizaman/nexus-outbox
=========================

Transactional outbox domain model and publish lifecycle (Layer 1).

v0.1.0-alpha1(1mo ago)02↓100%MITPHPPHP ^8.3

Since May 5Pushed 1mo agoCompare

[ Source](https://github.com/azaharizaman/nexus-outbox)[ Packagist](https://packagist.org/packages/azaharizaman/nexus-outbox)[ RSS](/packages/azaharizaman-nexus-outbox/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (2)Versions (2)Used By (0)

Nexus\\Outbox
=============

[](#nexusoutbox)

**Layer 1 — transactional outbox domain model and publish lifecycle**

This package defines **contracts and invariants** for the [transactional outbox pattern](https://microservices.io/patterns/data/transactional-outbox.html): enqueue integration messages **in the same unit of work** as business state, then **publish asynchronously** with explicit **pending → sending → sent | failed** semantics.

It is **not** a message broker, queue driver, or database layer. Persistence and workers live in **Layer 3** adapters. `InMemoryOutboxStore` is for tests and single-process use only (not a cross-process concurrency model; L3 should use row locking and unique constraints).

When to use
-----------

[](#when-to-use)

- You need **reliable fan-out** to Notifier, webhooks, analytics, or external systems **after** a successful commit.
- You pair with **`Nexus\EventStream`** when the system of record is an append-only stream but integrators do not consume the stream directly — see [`docs/event-stream-bridge.md`](docs/event-stream-bridge.md).

When not to use
---------------

[](#when-not-to-use)

- **Event sourcing / replay** of aggregate history → `Nexus\EventStream`.
- **HTTP command idempotency** (replay-safe API results) → `Nexus\Idempotency`.
- **Exactly-once end-to-end delivery** — not guaranteed; consumers must be **idempotent** or deduplicate (this package provides **exactly-once intent** at enqueue for a given dedup key within tenant scope).

Core types
----------

[](#core-types)

TypeRole`OutboxServiceInterface`Enqueue, claim next pending, mark sent/failed, schedule retry`OutboxStoreInterface`Composite query + persist (split interfaces available)`OutboxClockInterface`UTC `now()` for transitions and lease checks`InMemoryOutboxStore`Tests and local simulationsExample (sketch)
----------------

[](#example-sketch)

```
use Nexus\Outbox\Domain\OutboxEnqueueCommand;
use Nexus\Outbox\Services\InMemoryOutboxStore;
use Nexus\Outbox\Services\OutboxService;
use Nexus\Outbox\Services\SystemClock;
use Nexus\Outbox\ValueObjects\DedupKey;
use Nexus\Outbox\ValueObjects\EventTypeRef;
use Nexus\Outbox\ValueObjects\TenantId;

$tenantId = new TenantId('tenant-1');
$store = new InMemoryOutboxStore();
$clock = new SystemClock();
$outbox = new OutboxService($store, $store, $clock);

$now = $clock->now();
$leaseExpiresAt = $now->modify('+5 minutes');

$result = $outbox->enqueue(new OutboxEnqueueCommand(
    $tenantId,
    new DedupKey($streamEventId),
    new EventTypeRef($eventTypeFqcn),
    $payload,
    $metadata,
    $correlationId,
    $causationId,
    $now,
));

$claimed = $outbox->claimNextPending($tenantId, $leaseExpiresAt);
if ($claimed !== null) {
    // publish to external bus, then:
    $outbox->markSent($tenantId, $claimed->id, $claimed->claimToken);
}
```

Requirements
------------

[](#requirements)

- PHP 8.3+

Related documentation
---------------------

[](#related-documentation)

- [EventStream bridge](docs/event-stream-bridge.md)
- [IMPLEMENTATION\_SUMMARY.md](IMPLEMENTATION_SUMMARY.md)

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance93

Actively maintained with recent releases

Popularity3

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity34

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

36d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/117408?v=4)[Azahari Zaman](/maintainers/azaharizaman)[@azaharizaman](https://github.com/azaharizaman)

---

Top Contributors

[![azaharizaman](https://avatars.githubusercontent.com/u/117408?v=4)](https://github.com/azaharizaman "azaharizaman (5 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/azaharizaman-nexus-outbox/health.svg)

```
[![Health](https://phpackages.com/badges/azaharizaman-nexus-outbox/health.svg)](https://phpackages.com/packages/azaharizaman-nexus-outbox)
```

###  Alternatives

[symfony/symfony

The Symfony PHP framework

31.4k86.9M2.2k](/packages/symfony-symfony)[symfony/clock

Decouples applications from the system clock

432192.7M336](/packages/symfony-clock)[lcobucci/clock

Yet another clock abstraction

796201.8M146](/packages/lcobucci-clock)[ecotone/ecotone

Enterprise architecture layer for Laravel and Symfony — CQRS, Event Sourcing, Durable Workflows (Sagas, Orchestrators), Projections, and Outbox messaging via PHP attributes.

562565.8k41](/packages/ecotone-ecotone)[eventsauce/eventsauce

A pragmatic event sourcing library for PHP with a focus on developer experience.

8642.2M57](/packages/eventsauce-eventsauce)[flow-php/etl

PHP ETL - Extract Transform Load - Abstraction

377559.7k85](/packages/flow-php-etl)

PHPackages © 2026

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