eventsauce/message-repository-for-doctrine
Doctrine DBAL-backed EventSauce MessageRepository for persisting event streams. Supports configurable table/column schemas (default or legacy) and pluggable UUID encoding (binary or string), plus custom headers/columns for indexing and storage optimization.
\Illuminate\Database\Connection), requiring minimal setup.DefaultTableSchema or LegacyTableSchema.UUID extension).events table, Redis, or a custom solution)?additionalColumns extend it?db()->getDoctrineConnection()).TableSchema to match.events table, migrate data to the new schema.composer require eventsauce/message-repository-for-doctrine eventsauce/event-sauce eventsauce/uuid-encoding
use EventSauce\MessageRepository\DoctrineMessageRepository\DoctrineUuidV4MessageRepository;
use EventSauce\MessageRepository\TableSchema\DefaultTableSchema;
use EventSauce\UuidEncoding\BinaryUuidEncoder;
$repository = new DoctrineUuidV4MessageRepository(
connection: app('db')->getDoctrineConnection(),
tableName: 'event_store',
serializer: $eventSauceSerializer,
tableSchema: new DefaultTableSchema(),
uuidEncoder: new BinaryUuidEncoder(),
);
repository->store($event).Uuid (not Laravel’s Str::uuid()).event_id, aggregate_root_id, version, payload).LegacyTableSchema.TableSchema may require migrations (e.g., adding columns).payload size) and query performance (e.g., aggregate_root_id indexes).aggregate_root_id lookups but slow for global event queries (e.g., "all OrderCreated events").| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Database downtime | Event loss if not using WAL/replicas | Enable DB replication or use transaction logs. |
| Schema migration failure | Broken event replay | Backup old table; test migration in staging. |
| UUID collision (binary encoding) | Duplicate event IDs | Use StringUuidEncoder or validate UUIDs. |
| Large payloads (JSON bloat) | Slow queries, storage bloat | Compress payloads or use columnar storage. |
| EventSauce dependency issues | Broken serialization | Pin EventSauce version in composer.json. |
Event, Metadata).How can I help you explore Laravel packages today?