PHPackages                             desmart/laravel-event-sourcing - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. desmart/laravel-event-sourcing

ActiveProject[Utility &amp; Helpers](/categories/utility)

desmart/laravel-event-sourcing
==============================

Laravel bindings for DeSmart Event Sourcing package

1.0.0(10y ago)737MITPHPPHP &gt;=5.6.0

Since May 25Pushed 10y ago6 watchersCompare

[ Source](https://github.com/DeSmart/laravel-event-sourcing)[ Packagist](https://packagist.org/packages/desmart/laravel-event-sourcing)[ RSS](/packages/desmart-laravel-event-sourcing/feed)WikiDiscussions master Synced yesterday

READMEChangelog (1)Dependencies (6)Versions (2)Used By (0)

Laravel Event Sourcing
======================

[](#laravel-event-sourcing)

Simple Laravel implementation of event sourcing mechanism.

[![Latest version](https://camo.githubusercontent.com/ac042a3dbc6e2006ba135835b2e6e2f2fb061033e4b1a70251f22fb893f28d0d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f6465736d6172742f6c61726176656c2d6576656e742d736f757263696e672e737667)](https://github.com/DeSmart/laravel-event-sourcing/releases)[![Build Status](https://camo.githubusercontent.com/684b2737e4b42771756833f2924317de4c85647315b33ecb01510fd40a3f8d41/68747470733a2f2f7472617669732d63692e6f72672f4465536d6172742f6c61726176656c2d6576656e742d736f757263696e672e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/DeSmart/laravel-event-sourcing)[![Software License](https://camo.githubusercontent.com/074b89bca64d3edc93a1db6c7e3b1636b874540ba91d66367c0e5e354c56d0ea/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e737667)](https://github.com/desmart/laravel-event-sourcing/blob/master/LICENSE)

***Be advised:*** this package is work in progress and some breaking changes may appear on the way.

Package realizes concept of event sourcing with Laravel framework. Package consists of two main elements: implementation of database-like event store and projection manager.

Event store is a append-only storage dedicated for storing events. Projection manager allows to register projections and update them with generated stream of events.

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

[](#installation)

To install the package via Composer, simply run the following command:

```
composer require desmart/laravel-event-sourcing

```

In order to use provided event store implementation, register service provider in your `config/app.php` file:

```
'providers' => [
    // ...

    DeSmart\EventSourcing\Laravel\EventStore\ServiceProvider::class,
]
```

In order to use projection manager, register service provider in your `config/app.php` file:

```
'providers' => [
    // ...

    DeSmart\EventSourcing\Laravel\Projections\ServiceProvider::class,
]
```

After registering service provider(s), run artisan command to publish configuration files:

```
php artisan vendor:publish
```

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

[](#configuration)

Package adds two configuration files: `event-store.php` and `read-model.php`.

### `event-store.php`

[](#event-storephp)

Here you can configure:

- which connection will be used to connect with your event store,
- which event's payload serializer will be used.

```
return [
    /*
    |-------------------------------------------------------------------------------------
    | Database Connection For Event Store
    |-------------------------------------------------------------------------------------
    |
    | Specify which database connection should be used for storing events in events store.
    | All database connections can be found in config/database.php configuration file.
    |
    */

    'connection' => null,

    /*
    |-------------------------------------------------------------------------------------
    | Event Store Payload Serializer
    |-------------------------------------------------------------------------------------
    |
    | Serializer used for serializing/deserializing event and it's payload.
    |
    | Payload is usually of array type. It is sufficient to store payload in
    | JSON format.
    |
    | Supported serializers:
    | - 'JsonSerializer' -> use for event store that does not have automatic json serialization/deserialization, like mysql databases
    | - 'ArraySerializer -> use for event store that has automatic json serialization/deserialization, like mongodb databases
    |
    */

    'serializer' => \DeSmart\EventSourcing\Laravel\EventStore\Serializers\JsonSerializer::class
];
```

### `read-model.php`

[](#read-modelphp)

Here you can register all projections that should be notified with stream of events.

```
return [
    /*
    |--------------------------------------------------------------------------
    | Read Model Projections
    |--------------------------------------------------------------------------
    |
    | Array of projection classes.
    |
    | These projections will be notified about saved stream of events and they
    | can react with read model updates.
    |
    */

    'projections' => []
];
```

Event store implementation
--------------------------

[](#event-store-implementation)

This package's event store implementation was successfully used/tested with MySql database, MongoDB database as well as with mix of the two: one database served as an event store, where second was storing projections.

Event store required structure (however different column types allowed) can be found [here](https://github.com/DeSmart/laravel-event-sourcing/blob/master/example/database/migrations/2016_05_16_125159_create_event_store_table.php).

License
-------

[](#license)

Package is released under the MIT License (MIT). Please, check [LICENSE](https://github.com/desmart/laravel-event-sourcing/blob/master/LICENSE) for more details.

Example usage
-------------

[](#example-usage)

For example use of event store as well as project manager, check [`example/`](https://github.com/desmart/laravel-event-sourcing/tree/master/example) directory.

Additionally, package provides artisan command for rebuilding all projections:

```
php artisan projections:rebuild
```

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 91.7% 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

3688d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/92bc27fc8f1cba837cef419eee0fae358f52c804cd5450cf994f9095fa387a5c?d=identicon)[DeSmart](/maintainers/DeSmart)

![](https://www.gravatar.com/avatar/1a3c56cab812fc073277f1e127a12e0c6066565dc57bd3045484fcca1901021b?d=identicon)[gollum](/maintainers/gollum)

---

Top Contributors

[![golonix](https://avatars.githubusercontent.com/u/9950778?v=4)](https://github.com/golonix "golonix (11 commits)")[![radmen](https://avatars.githubusercontent.com/u/1190255?v=4)](https://github.com/radmen "radmen (1 commits)")

---

Tags

eventlaravelsourcing

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/desmart-laravel-event-sourcing/health.svg)

```
[![Health](https://phpackages.com/badges/desmart-laravel-event-sourcing/health.svg)](https://phpackages.com/packages/desmart-laravel-event-sourcing)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3345.1M337](/packages/psalm-plugin-laravel)[larastan/larastan

Larastan - Discover bugs in your code without running it. A phpstan/phpstan extension for Laravel

6.4k51.0M7.7k](/packages/larastan-larastan)[laravel/ai

The official AI SDK for Laravel.

1.0k2.1M163](/packages/laravel-ai)[spatie/laravel-health

Monitor the health of a Laravel application

87411.3M154](/packages/spatie-laravel-health)[illuminate/queue

The Illuminate Queue package.

20432.2M1.5k](/packages/illuminate-queue)[calebdw/larastan

Larastan - Discover bugs in your code without running it. A phpstan/phpstan extension for Laravel

15104.9k4](/packages/calebdw-larastan)

PHPackages © 2026

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