PHPackages                             robin-malfait/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. [Framework](/categories/framework)
4. /
5. robin-malfait/event-sourcing

ActiveLibrary[Framework](/categories/framework)

robin-malfait/event-sourcing
============================

An EventSourcing Package

v3.0.3(9y ago)7126MITPHPPHP &gt;=5.5.0

Since Jul 25Pushed 9y ago2 watchersCompare

[ Source](https://github.com/RobinMalfait/EventSourcing)[ Packagist](https://packagist.org/packages/robin-malfait/event-sourcing)[ Docs](https://github.com/robinmalfait/EventSourcing)[ RSS](/packages/robin-malfait-event-sourcing/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (6)Versions (23)Used By (0)

EventSourcing
=============

[](#eventsourcing)

[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)

This is a simple EventSourcing package that you can use in your projects. This project is written using PSR2

Install
-------

[](#install)

Via Composer

```
$ composer require robin-malfait/event-sourcing
```

Usage
-----

[](#usage)

Register the service provider

```
'providers' => [
    ...
    \EventSourcing\Laravel\EventSourcingServiceProvider::class,
]
```

Publish the configuration file

```
php artisan vendor:publish --provider="EventSourcing\Laravel\EventSourcingServiceProvider"
```

The config file looks like this:

[Config File](src/Laravel/Config/event_sourcing.php)

You can now tweak some configurations

Last but not least make the event store table:

```
php artisan event-sourcing:table

```

Update v1 to v2
---------------

[](#update-v1-to-v2)

If you are still using the first version you better update to version 2. You will have less problems in the future, I promise.

In Version 2 we give each DomainEvent the responsibility to give data and receive data. Those methods are

> `serialize();` Which returns an array of serialized data
>
> `deserialize(array $data);` Which has a parameter with the data that basically comes from the serialize method. This method should also return an instance of the current event.

### For Example:

[](#for-example)

```
