EventSauce.

A pragmatic event sourcing library for PHP with a focus on developer experience.

Docs Newsletter Slack GitHub Twitter

Scrutinizer Code Quality Latest Version

Why use EventSauce?

Model your domain using event sourcing; a message-driven approach that provides clarity when dealing with complex business requirements. The library is designed so you can take full control.

Events

Expressive Testing

Scenario based testing provides an expressive way to ensure business requirements are met.

An event-driven modeling technique allows for a BDD-style test setup. This technique allows you to use events to setup your aggregate and assert desired outcome.

<?php

use EventSauce\EventSourcing\AggregateRootTestCase;

class MyEventSourcedTest extends AggregateRootTestCase
{
    public function submitting_a_bank_account_for_approval()
    {
        $iban = 'NL91ABCD0123123400';

        $this->given(
            new OnboardingHasStarted()
        )->when(
            new SubmitBankAccountForApproval($iban)
        )->then(
            new BankAccountWasSubmittedForApproval($iban)
        );
    }
}

Code Generation

Generated event and command definitions can greatly speed up your workflow. The built-in code generation tools provide an easy way to create them quickly.

namespace: modelingWith\EventSauce

commands:
  StartsUsingEventSauce:
    fields:
      id: developerId

events:
  UsingEventSauceWasVeryEffective:
    fields: []
  DeveloperAcquiredNewSkill:
    fields:
      acquiredSkill:
        type: AcquiredSkill
        example: EVENT_SOURCING

Newsletter

Slack

Want to discuss event sourcing with other developers? Find like-minded devs to discuss topics or ask questions.

Join the Slack Channel
Frank de Jonge

EventSauce is a project by Frank de Jonge.

This website is built using Tailwind CSS, Zondicons, and Webpack.