Skip to content

Installation

If you are not using a symfony flex or the recipes for it, then you have to carry out a few installation steps by hand.

Require package

The first thing to do is to install packet if it has not already been done.

composer require patchlevel/event-sourcing-bundle

Note

how to install composer

Enable bundle

Then we have to activate the bundle in the config/bundles.php:

use Patchlevel\EventSourcingBundle\PatchlevelEventSourcingBundle;

return [
    PatchlevelEventSourcingBundle::class => ['all' => true],
];

Configuration file

Now you have to add following recommended configuration file here config/packages/patchlevel_event_sourcing.yaml.

patchlevel_event_sourcing:
    aggregates: '%kernel.project_dir%/src'
    events: '%kernel.project_dir%/src'
    connection:
      url: '%env(EVENTSTORE_URL)%'

when@dev:
  patchlevel_event_sourcing:
    subscription:
      catch_up: true
      throw_on_error: true
      run_after_aggregate_save: true
      rebuild_after_file_change: true
      auto_setup: true

when@test:
  patchlevel_event_sourcing:
    subscription:
      catch_up: true
      throw_on_error: true
      run_after_aggregate_save: true

Dotenv

Finally, we have to fill the ENV variable with a connection url.

EVENTSTORE_URL=pdo-pgsql://user:secret@localhost/app

Note

You can find out more about what a connection url looks like here.

Success

You have successfully installed the bundle. Now you can start with the quickstart to get a feeling for the bundle.