EventSauce.

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

Docs Newsletter Slack GitHub Twitter

Latest Version

Why use EventSauce?

Model your domain using event sourcing; an event-driven approach that provides clarity when dealing with complex business requirements. The library is designed to give you full control.

Out of the box support for:

  • Anti-corruption layers (ACL)
  • Customizable serialization
  • Adaptable storage and transports
  • Snapshotting
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.

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

Want to stay up to date? Be notified when important changes happen.

Subscribe

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.