PHPackages                             rasuvaeff/yii3-outbox-db - 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. rasuvaeff/yii3-outbox-db

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

rasuvaeff/yii3-outbox-db
========================

Database-backed outbox storage for Yii3

v1.0.2(4w ago)01↓50%BSD-3-ClausePHPPHP 8.3 - 8.5CI passing

Since Jun 13Pushed 1w agoCompare

[ Source](https://github.com/rasuvaeff/yii3-outbox-db)[ Packagist](https://packagist.org/packages/rasuvaeff/yii3-outbox-db)[ Docs](https://github.com/rasuvaeff/yii3-outbox-db)[ RSS](/packages/rasuvaeff-yii3-outbox-db/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependencies (29)Versions (4)Used By (0)

rasuvaeff/yii3-outbox-db
========================

[](#rasuvaeffyii3-outbox-db)

[![Stable Version](https://camo.githubusercontent.com/15c25b8e111dd3c1fe6d670bfca4f5141ee5e84d44dc84b7f82a15247cca6a63/68747470733a2f2f706f7365722e707567782e6f72672f7261737576616566662f796969332d6f7574626f782d64622f762f737461626c65)](https://packagist.org/packages/rasuvaeff/yii3-outbox-db)[![Total Downloads](https://camo.githubusercontent.com/20fa255f9f5c77df0434b0116a3121115e399ebe7a7deab32b85cd4ee0276dcb/68747470733a2f2f706f7365722e707567782e6f72672f7261737576616566662f796969332d6f7574626f782d64622f646f776e6c6f616473)](https://packagist.org/packages/rasuvaeff/yii3-outbox-db)[![Build](https://github.com/rasuvaeff/yii3-outbox-db/actions/workflows/build.yml/badge.svg)](https://github.com/rasuvaeff/yii3-outbox-db/actions)[![Static analysis](https://github.com/rasuvaeff/yii3-outbox-db/actions/workflows/static-analysis.yml/badge.svg)](https://github.com/rasuvaeff/yii3-outbox-db/actions)[![Psalm Level](https://camo.githubusercontent.com/8daf9542ac9bda29719290af489ec575378b4d8cff24ade204d67cb88e57cf3b/68747470733a2f2f73686570686572642e6465762f6769746875622f7261737576616566662f796969332d6f7574626f782d64622f6c6576656c2e737667)](https://shepherd.dev/github/rasuvaeff/yii3-outbox-db)[![License](https://camo.githubusercontent.com/fcb931f02c0f673fad713bc19e5cf5d012dd997902fbb5b2b8d52443bd60a8ff/68747470733a2f2f706f7365722e707567782e6f72672f7261737576616566662f796969332d6f7574626f782d64622f6c6963656e7365)](https://packagist.org/packages/rasuvaeff/yii3-outbox-db)[Русская версия](README.ru.md)

Database-backed storage for [`rasuvaeff/yii3-outbox`](https://github.com/rasuvaeff/yii3-outbox). Durably persists outbox messages in a `yiisoft/db` table so a worker can publish or export them asynchronously — surviving process restarts and downstream outages.

> Using an AI coding assistant? [llms.txt](llms.txt) has a compact API reference you can use.

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

[](#requirements)

- PHP 8.3+
- `rasuvaeff/yii3-outbox` ^1.0
- `yiisoft/db` ^2.0, `yiisoft/db-migration` ^2.0

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

[](#installation)

```
composer require rasuvaeff/yii3-outbox-db
```

Usage
-----

[](#usage)

### Migration

[](#migration)

Apply the bundled migration to create the `outbox` table (default name `outbox`):

```
use M260611000000CreateOutboxTable;

(new M260611000000CreateOutboxTable())->up($migrationBuilder);
// custom table: new M260611000000CreateOutboxTable(table: 'my_outbox')
```

### Recording and processing

[](#recording-and-processing)

```
use Rasuvaeff\Yii3Outbox\Outbox;
use Rasuvaeff\Yii3OutboxDb\DbOutboxStorage;

$storage = new DbOutboxStorage(db: $connection);          // ConnectionInterface
$outbox = new Outbox(storage: $storage, clock: $clock);

// request path — durable, no network call to the sink
$outbox->record(type: 'ab.exposure', payload: '{"experiment":"checkout"}');

// worker — fetch a batch of one consumer's types and process them
$pending = $storage->findPending(types: ['ab.exposure', 'ab.conversion'], limit: 1000);
```

### Storage API

[](#storage-api)

MethodPurpose`save(OutboxMessage)`upsert by `id` (initial record or retry re-save)`findPending(array $types = [], int $limit = 1000)`pending rows, optional type filter, `created_at` ASC`markPublished(OutboxMessage)`re-save with `Published` status`markFailed(OutboxMessage)`re-save with `Failed` status`getById(string $id)`single message or `null``deleteByStatus(OutboxStatus)`housekeeping (e.g. purge `Published`)`findPending`'s `$types` filter lets several consumers — a generic `Processor`and a specialized exporter — share one outbox without competing for each other's messages.

### Yii3 DI

[](#yii3-di)

The config-plugin binds `StorageInterface` to `DbOutboxStorage` from `config/di.php`. Core `yii3-outbox` binds nothing, so this backend (or the application) is the single source of `StorageInterface`. Set the table name in params:

```
// config/params.php
'rasuvaeff/yii3-outbox-db' => ['table' => 'outbox'],
```

Security
--------

[](#security)

- All values are written through `yiisoft/db` parameterized commands.
- `OutboxRowMapper` validates every column and rejects corrupt rows with `InvalidOutboxRowException` — no silent coercion.
- Payloads may contain PII; retention/purging is the application's responsibility (`deleteByStatus` helps).

Examples
--------

[](#examples)

Runnable scripts live in [`examples/`](examples/).

Development
-----------

[](#development)

```
make build        # full gate: validate + normalize + require-checker + cs + psalm + test
make cs-fix
make psalm
make test
make test-coverage
make mutation
```

Core `yii3-outbox` is consumed via a path repository while unpublished — see [AGENTS.md](AGENTS.md) for the monorepo-root Docker invocation.

License
-------

[](#license)

BSD-3-Clause. See [LICENSE.md](LICENSE.md).

###  Health Score

42

—

FairBetter than 88% of packages

Maintenance97

Actively maintained with recent releases

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity53

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

Every ~8 days

Total

3

Last Release

28d ago

### Community

Maintainers

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

---

Top Contributors

[![rasuvaeff](https://avatars.githubusercontent.com/u/1352718?v=4)](https://github.com/rasuvaeff "rasuvaeff (9 commits)")

---

Tags

databasemigrationsoutbox-patternphpyii-dbyii3databasestoragedbtransactionalyii3outbox

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm, Rector

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/rasuvaeff-yii3-outbox-db/health.svg)

```
[![Health](https://phpackages.com/badges/rasuvaeff-yii3-outbox-db/health.svg)](https://phpackages.com/packages/rasuvaeff-yii3-outbox-db)
```

###  Alternatives

[robmorgan/phinx

Phinx makes it ridiculously easy to manage the database migrations for your PHP app.

4.5k48.7M472](/packages/robmorgan-phinx)[spatie/laravel-translation-loader

Store your language lines in the database, yaml or other sources

8453.2M74](/packages/spatie-laravel-translation-loader)[aura/sqlquery

Object-oriented query builders for MySQL, Postgres, SQLite, and SQLServer; can be used with any database connection library.

4883.1M40](/packages/aura-sqlquery)[envms/fluentpdo

FluentPDO is a quick and light PHP library for rapid query building. It features a smart join builder, which automatically creates table joins.

925542.3k13](/packages/envms-fluentpdo)[danielme85/laravel-log-to-db

Custom Laravel Log channel handler that can store log events to SQL or MongoDB databases. Uses Laravel native logging functionality.

1341.0M1](/packages/danielme85-laravel-log-to-db)[amphp/postgres

Asynchronous PostgreSQL client for Amp.

109584.1k39](/packages/amphp-postgres)

PHPackages © 2026

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