spriebsch/sequora

There is no license information available for the latest version (1.3.0) of this package.

A simple, reliable SQLite-backed event store for PHP domain events

Maintainers

Package info

github.com/spriebsch/sequora

Type:project

pkg:composer/spriebsch/sequora

Transparency log

Statistics

Installs: 38

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

1.3.0 2026-07-14 21:29 UTC

This package is auto-updated.

Last update: 2026-07-14 21:30:37 UTC


README

The Next-Generation Event Store.

Sequora is a made-up word combining the components sequence and aura. Sequence because an event store must store events in a strict sequence. Aura because it is a source of insight and knowledge and represents the fact that an event store is the authoritative source of truth in an event-based system.

Sequora was created by Stefan Priebsch stefan@priebsch.de.

Installation

Install Sequora via Composer:

composer require spriebsch/sequora

Usage

Initializing the Event Store

Sequora uses SQLite as its storage engine. You need to provide a SqliteConnection and initialize the schema.

use spriebsch\sequora\SqliteSequoraSchema;
use spriebsch\sqlite\SqliteConnection;

$connection = SqliteConnection::fromMemory();
SqliteSequoraSchema::from($connection)->init();

Writing Events

To write events, use the SequoraWriter. It accepts DomainEvent instances.

use spriebsch\sequora\SequoraWriter;
use spriebsch\sequora\SqliteDatabaseWriter;

$dbWriter = SqliteDatabaseWriter::from($connection);
$writer = SequoraWriter::from($dbWriter);

$writer->store($event1, $event2);

Reading Events

To read events, use the SequoraReader. You need to provide a topic map that maps event topics to their corresponding PHP classes.

use spriebsch\sequora\SequoraReader;
use spriebsch\sequora\SqliteDatabaseReader;

$topicMap = [
    'vendor.domain.context.event_name' => MyEvent::class,
];

$dbReader = SqliteDatabaseReader::from($connection, $topicMap);
$reader = SequoraReader::from($dbReader);

// Read all events
$events = $reader->all();

foreach ($events as $envelope) {
    $event = $envelope->payload()->asEvent();
    // ...
}

Generating a Topic Map

You can generate a topic map by running the generate-topic-map tool. It scans a directory for classes that implement DomainEvent and have a Topic attribute. The generated file TopicMap.php will be placed in the specified directory.

vendor/bin/generate-topic-map <directory-with-events>

The generated file returns an associative array that you can use when initializing the SqliteDatabaseReader:

$topicMap = require __DIR__ . '/path/to/TopicMap.php';
$dbReader = SqliteDatabaseReader::from($connection, $topicMap);

Querying Events

You can filter events using EventQuery.

use spriebsch\sequora\EventQuery;
use spriebsch\DomainEvent\Topic;

$query = EventQuery::from()
    ->withTopics(Topic::fromString('vendor.domain.context.event_name'))
    ->limit(10);

$events = $reader->query($query);