rxthunder / eventstore
EventStore library for RxThunder
Requires
- php: ^7.2
- php-http/httplug: ^2.0
- php-http/message-factory: ^1.0
- rxnet/eventstore-client: ^3.0.1
- rxthunder/core: ^0.6.0
- voryx/event-loop: ^3.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.12
- phpro/grumphp: ^0.15.0
- phpstan/phpstan: 0.11.2
This package is auto-updated.
Last update: 2024-11-22 02:03:32 UTC
README
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