rxthunder/eventstore

EventStore library for RxThunder

0.2.0 2019-10-21 14:05 UTC

This package is auto-updated.

Last update: 2024-04-22 00:44:54 UTC


README

thunder-logo.svg

Latest Stable Version Total Downloads License

Build

Installation

composer install rxthunder/eventstore

Setup

First you must add new secrets in your .env files

# .env
EVENTSTORE_DSN_HTTP=
EVENTSTORE_DSN_TCP=

Then configure new parameters to be injected in the container

# config/parameters.php

$container->setParameter('eventstore.http', getenv('EVENTSTORE_DSN_HTTP'));
$container->setParameter('eventstore.tcp', getenv('EVENTSTORE_DSN_TCP'));

Copy paste the configuration of the desired console

# config/services.php

require_once __DIR__ . '/../vendor/rxthunder/eventstore/config/services.php';

use RxThunder\EventStore\Console\EventStoreConsole;
use RxThunder\EventStore\Console\EventStoreSetupConsole;

$container->register(EventStoreConsole::class)
    ->setPublic(true)
    ->setAutowired(true)
    ->setAutoconfigured(true)
;

$container->register(EventStoreSetupConsole::class)
    ->setPublic(true)
    ->setAutowired(true)
    ->setAutoconfigured(true)
;

Or if you prefer you can include the all existing and futures consoles

# config/services.php

require_once __DIR__ . '/../vendor/rxthunder/eventstore/config/services.php';
require_once __DIR__ . '/../vendor/rxthunder/eventstore/config/consoles.php';

Tip

If you don't need to automatically setup your EventStore projections with the relative console, then don't register the EventStoreSetupConsole.

This avoids the need to configure the following chapter.

PHP-HTTP

It remain a final step, only if you want to use the EventStoreSetupConsole.

If you haven't already added a HTTP client implementation (PSR-18) into the DI. Find here a list of existing implementation

Similarly HTTP Requests must be built by your favorite factory, and you can found some library ready to use on packagist.

Afterward simply alias your favorite client and factory with the interfaces.

$container->setAlias(\Psr\Http\Client\ClientInterface::class, ClientImplementation::class);
$container->setAlias(Http\Message\RequestFactory::class, FactoryImplementation::class);

Profit

You got new consoles !

php vendor/bin/thunder