diff --git a/README.md b/README.md index dfc05f2..4e7dd88 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,30 @@ Install via [composer](https://getcomposer.org): composer require neos/eventstore-doctrineadapter ``` +### Create an instance + +To create a `DoctrineEventStore`, an instance of `\Doctrine\DBAL\Connection` is required. +This can be obtained from a given DSN for example: + +```php +use Doctrine\DBAL\DriverManager; + +$connection = DriverManager::getConnection(['url' => $dsn]); +``` + +See [Doctrine documentation](https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#getting-a-connection) for more details. + +With that, an Event Store instance can be created: + +```php +use Neos\EventStore\DoctrineAdapter\DoctrineEventStore; + +$eventTableName = 'some_namespace_events'; +$eventStore = new DoctrineEventStore($connection, $eventTableName); +``` + +See [README](https://github.com/neos/eventstore/blob/main/README.md#usage) of the `neos/eventstore` package for details on how to write and read events. + ## Contribution Contributions in the form of [issues](https://github.com/neos/eventstore-doctrineadapter/issues), [pull requests](https://github.com/neos/eventstore-doctrineadapter/pulls) or [discussions](https://github.com/neos/eventstore-doctrineadapter/discussions) are highly appreciated diff --git a/composer.json b/composer.json index 9c136f6..c1386be 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,7 @@ ], "require": { "php": "^8.1", - "neos/eventstore": "@dev", + "neos/eventstore": "^1", "doctrine/dbal": "^2", "webmozart/assert": "^1.10", "psr/clock": "^1"