PHPackages                             spriebsch/longbow - 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. [Testing &amp; Quality](/categories/testing)
4. /
5. spriebsch/longbow

ActiveLibrary[Testing &amp; Quality](/categories/testing)

spriebsch/longbow
=================

An event framework for PHP domain events

7.1.0(2w ago)01.0kBSD-3-ClausePHPPHP ^8.5

Since Mar 10Pushed 2w ago1 watchersCompare

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

READMEChangelogDependencies (13)Versions (22)Used By (0)

Longbow
=======

[](#longbow)

Aim high and shoot far with Longbow, the PHP 8.5 event framework.

Longbow 7 uses [Domain Event](https://github.com/spriebsch/domain-event) for event definitions and [Sequora](https://github.com/spriebsch/sequora) for persistence.

Domain events
-------------

[](#domain-events)

Events are readonly data objects. Topics and correlation identifiers are declared with attributes:

```
use spriebsch\DomainEvent\AbstractId;
use spriebsch\DomainEvent\DomainEvent;
use spriebsch\DomainEvent\MapToTopic;
use spriebsch\DomainEvent\UseAsCorrelationId;

final readonly class OrderId extends AbstractId
{
}

#[MapToTopic('acme.sales.order.order-placed')]
final readonly class OrderPlaced implements DomainEvent
{
    public function __construct(
        private OrderId $orderId,
        public string $product,
    ) {
    }

    #[UseAsCorrelationId]
    public function orderId(): OrderId
    {
        return $this->orderId;
    }
}
```

Generate the topic map with Domain Event's `generate-topic-map` command and return its file from the application configuration.

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

[](#configuration)

Application configuration implements `spriebsch\longbow\LongbowConfiguration`and supplies:

- the orchestration directory;
- the generated topic-map file;
- the Sequora SQLite database path;
- the Longbow processor-position SQLite database path.

Configure Longbow with the application factory:

```
Longbow::configure($configuration, ApplicationFactory::class);
```

Command handlers persist their returned events through `spriebsch\sequora\EventWriter`:

```
public function handle(PlaceOrder $command): DomainEvent
{
    $event = new OrderPlaced(OrderId::generate(), $command->product);
    $this->eventWriter->store($event);

    return $event;
}
```

Event streams
-------------

[](#event-streams)

Streams extend Longbow's query-focused base class and define Sequora topics:

```
final readonly class SalesEvents extends EventStream
{
    protected function topics(): array
    {
        return [Topic::fromString('acme.sales.order.order-placed')];
    }
}
```

Processors implement `EventStreamProcessor` and return an `EventStreamProcessorId`. Longbow reads Sequora envelopes, passes their domain events to processor methods, and stores the envelope event ID as the processor position.

When a processor fails, Longbow leaves its successful position unchanged and persists the failed event ID, timestamp, exception class, and exception message. Applications can use `Longbow::processorFailures()` to distinguish a processor that has not started from one that failed. A successful retry clears the persisted failure.

Upgrading
---------

[](#upgrading)

Longbow 7 is a breaking release. It requires PHP 8.5 and does not migrate databases created by `spriebsch/eventstore`; start with a fresh Sequora schema or migrate existing event data with an application-specific migration.

(c) Stefan Priebsch.

###  Health Score

50

—

FairBetter than 95% of packages

Maintenance97

Actively maintained with recent releases

Popularity16

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 98% 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 ~25 days

Recently: every ~2 days

Total

21

Last Release

14d ago

Major Versions

4.5.1 → 5.0.02025-03-16

5.5.0 → 6.0.02025-04-29

6.1.0 → 7.0.02026-07-26

PHP version history (2 changes)4.5.0PHP &gt;=8.4

7.0.0PHP ^8.5

### Community

Maintainers

![](https://www.gravatar.com/avatar/2064fee9073bee511de4bec7616a42c24e79c2dd8312f0363b5b3850f00b83ab?d=identicon)[spriebsch](/maintainers/spriebsch)

---

Top Contributors

[![spriebsch](https://avatars.githubusercontent.com/u/61342?v=4)](https://github.com/spriebsch "spriebsch (48 commits)")[![sebastianbergmann](https://avatars.githubusercontent.com/u/25218?v=4)](https://github.com/sebastianbergmann "sebastianbergmann (1 commits)")

### Embed Badge

![Health badge](/badges/spriebsch-longbow/health.svg)

```
[![Health](https://phpackages.com/badges/spriebsch-longbow/health.svg)](https://phpackages.com/packages/spriebsch-longbow)
```

PHPackages © 2026

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