PHPackages                             micro-module/outbox-bundle - 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. micro-module/outbox-bundle

ActiveSymfony-bundle

micro-module/outbox-bundle
==========================

Transactional Outbox Pattern bundle for reliable event delivery in event-sourced systems

v0.1.0(1mo ago)00proprietaryPHPPHP ^8.4

Since Mar 27Pushed 1mo agoCompare

[ Source](https://github.com/temafey/micro_modules_outbox_bundle)[ Packagist](https://packagist.org/packages/micro-module/outbox-bundle)[ RSS](/packages/micro-module-outbox-bundle/feed)WikiDiscussions master Synced 1mo ago

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

MicroModule Outbox Bundle
=========================

[](#micromodule-outbox-bundle)

Transactional Outbox Pattern bundle for reliable event delivery in event-sourced Symfony applications.

Features
--------

[](#features)

- **Transactional Outbox**: Domain events and task commands are written to an outbox table within the same database transaction, then published asynchronously
- **Broadway Integration**: Optional EventStore decorator that automatically captures events to the outbox
- **Dual Publishers**: Separate EventPublisher (RabbitMQ) and TaskPublisher with a unified OutboxPublisher orchestrator
- **OpenTelemetry Metrics**: Optional counters, histograms, and gauges for outbox operations
- **Feature Flag**: Runtime toggle via `OUTBOX_ENABLED` environment variable
- **Console Commands**: Background publisher poller and cleanup for expired entries
- **DDD Layering**: Clean Domain/Infrastructure separation with interfaces

Architecture
------------

[](#architecture)

```
Command Handler
    └── EventStore (wrapped by OutboxAwareEventStore)
            ├── Broadway EventStore (event persistence)
            └── OutboxRepository (outbox entry in same transaction)

Background Poller (PublishOutboxCommand)
    └── OutboxPublisher
            ├── EventPublisher → RabbitMQ
            └── TaskPublisher → Task Queue

Cleanup (CleanupOutboxCommand)
    └── OutboxRepository::deletePublishedBefore()

```

Installation
------------

[](#installation)

```
composer require micro-module/outbox-bundle
```

Register the bundle in `config/bundles.php`:

```
return [
    // ...
    MicroModule\Outbox\OutboxBundle::class => ['all' => true],
];
```

Configuration
-------------

[](#configuration)

```
# config/packages/micro_outbox.yaml
micro_outbox:
    connection: doctrine.dbal.write_connection  # DBAL connection for outbox table
    publisher:
        batch_size: 100           # Max entries per poll cycle
        poll_interval_ms: 1000    # Poll interval in milliseconds
    cleanup:
        retention_days: 30        # Days to keep published entries
        dead_letter_retention_days: 90  # Days to keep dead-letter entries
    broadway:
        enabled: true             # Enable OutboxAwareEventStore (requires broadway/broadway)
    metrics:
        enabled: false            # Enable OpenTelemetry metrics (requires open-telemetry/sdk)
```

Database Schema
---------------

[](#database-schema)

The outbox table must be created via migration:

```
CREATE TABLE outbox (
    id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
    message_type VARCHAR(20) NOT NULL,  -- 'event' or 'task'
    payload JSONB NOT NULL,
    headers JSONB DEFAULT '{}',
    status VARCHAR(20) NOT NULL DEFAULT 'pending',
    retry_count INTEGER NOT NULL DEFAULT 0,
    max_retries INTEGER NOT NULL DEFAULT 3,
    created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
    published_at TIMESTAMPTZ,
    failed_at TIMESTAMPTZ,
    error_message TEXT
);

CREATE INDEX idx_outbox_status_created ON outbox (status, created_at);
```

Console Commands
----------------

[](#console-commands)

```
# Publish pending outbox entries (background poller)
bin/console outbox:publish --batch-size=100 --poll-interval=1000

# Cleanup old published entries
bin/console outbox:cleanup --retention-days=30 --dead-letter-retention-days=90
```

Key Classes
-----------

[](#key-classes)

ClassPurpose`OutboxBundle`Symfony AbstractBundle with conditional loading`OutboxEntryInterface`Domain contract for outbox entries`OutboxRepositoryInterface`Domain contract for persistence`DbalOutboxRepository`DBAL implementation of outbox storage`OutboxAwareEventStore`Broadway EventStore decorator (captures events to outbox)`OutboxAwareTaskProducer`Task producer that writes to outbox instead of direct queue`OutboxPublisher`Orchestrates EventPublisher + TaskPublisher`EventPublisher`Publishes domain events to RabbitMQ`TaskPublisher`Publishes task commands to task queue`OutboxFeatureFlag`Runtime toggle via `OUTBOX_ENABLED` env var`OpenTelemetryOutboxMetrics`OTel counters/histograms for monitoring`NullOutboxMetrics`No-op metrics (default when OTel disabled)Optional Dependencies
---------------------

[](#optional-dependencies)

PackagePurpose`broadway/broadway`Required for `OutboxAwareEventStore` and `BroadwayDomainEventSerializer``micro-module/enqueue`Required for `EventPublisher` (RabbitMQ queue publishing)`open-telemetry/sdk`Required for `OpenTelemetryOutboxMetrics`Requirements
------------

[](#requirements)

- PHP 8.4+
- Symfony 7.0+ or 8.0+
- Doctrine DBAL 4.4+

License
-------

[](#license)

Proprietary

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance90

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 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

48d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/bb0e6b6ff14b9d53d413617c42ddb1f83ff451c32beac02bc4ebebb6cfabeb00?d=identicon)[temafey](/maintainers/temafey)

---

Top Contributors

[![temafey](https://avatars.githubusercontent.com/u/981101?v=4)](https://github.com/temafey "temafey (3 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StyleECS

Type Coverage Yes

### Embed Badge

![Health badge](/badges/micro-module-outbox-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/micro-module-outbox-bundle/health.svg)](https://phpackages.com/packages/micro-module-outbox-bundle)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.2M386](/packages/shopware-core)[drupal/core

Drupal is an open source content management platform powering millions of websites and applications.

19462.3M1.3k](/packages/drupal-core)[contao/core-bundle

Contao Open Source CMS

1231.6M2.4k](/packages/contao-core-bundle)

PHPackages © 2026

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