{"id":22496969,"url":"https://github.com/morebec/orkestra-postgresql-eventstore","last_synced_at":"2026-05-20T10:13:13.371Z","repository":{"id":49499659,"uuid":"359992877","full_name":"Morebec/orkestra-postgresql-eventstore","owner":"Morebec","description":"[READ ONLY] PostgreSQL Event Store for Orkestra","archived":false,"fork":false,"pushed_at":"2023-03-31T18:46:54.000Z","size":38,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"2.x","last_synced_at":"2025-02-01T23:45:07.562Z","etag":null,"topics":["event-sourcing","event-store","orkestra","php","postgresql"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Morebec.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-04-21T01:02:34.000Z","updated_at":"2022-07-25T15:52:03.000Z","dependencies_parsed_at":"2024-11-27T06:34:24.067Z","dependency_job_id":null,"html_url":"https://github.com/Morebec/orkestra-postgresql-eventstore","commit_stats":{"total_commits":58,"total_committers":2,"mean_commits":29.0,"dds":"0.017241379310344862","last_synced_commit":"0d88403f366e238b3eff434f54f84a7357a7d02c"},"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Morebec%2Forkestra-postgresql-eventstore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Morebec%2Forkestra-postgresql-eventstore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Morebec%2Forkestra-postgresql-eventstore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Morebec%2Forkestra-postgresql-eventstore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Morebec","download_url":"https://codeload.github.com/Morebec/orkestra-postgresql-eventstore/tar.gz/refs/heads/2.x","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245925699,"owners_count":20694947,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["event-sourcing","event-store","orkestra","php","postgresql"],"created_at":"2024-12-06T20:15:04.520Z","updated_at":"2026-05-20T10:13:13.339Z","avatar_url":"https://github.com/Morebec.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PostgreSqlEventStore\nThis component provides an implementation of a the an Event Store (from the [EventSourcing Component]())\nusing PostgreSQL.\n\nUnder the hood, it uses DBAL for communication with PostgreSQL.\n\n## Installation\n```shell\ncomposer require morebec/orkestra-orkestra-postgresql-eventstore\n```\n\n## Usage\n\n```php\nuse Morebec\\Orkestra\\PostgreSqlEventStore\\PostgreSqlEventStore;\nuse Morebec\\Orkestra\\PostgreSqlEventStore\\PostgreSqlEventStoreConfiguration;\n\n$connection = DriverManager::getConnection([\n    'url' =\u003e '...'\n], new Configuration()); \n\n$config = new PostgreSqlEventStoreConfiguration();\n$store = new PostgreSqlEventStore($connection, $config);\n\n```\n\n### Event Store Subscriptions\nThe pu/sub mechanism of the event store is implemented using PostgreSQL's `LISTEN/NOTIFY` feature.\nUnfortunately given the nature of PHP being a synchronous RunTime, the only way to have Pub/Sub capabilities\nis to run a `LISTEN` loop: \n\n```php\n// This method will start a loop and listen for communications from PostgreSQL's LISTEN/NOTIFY mechanis.\n$store-\u003enotifySubscribers();\n```\n\nThis is can be used with `Event Processors`.\n\n### PostgreSqlEventStorePositionStorage\nAn implementation of `EventStorePositionStorageInterface` is also shipped with the component as the `PostgreSqlEventStorePositionStorage`,\nwhich also relies on DBAL for communication with PostgreSQL:\n\n```php\nuse Morebec\\Orkestra\\PostgreSqlEventStore\\PostgreSqlEventStorePositionStorage;\nuse Morebec\\Orkestra\\PostgreSqlEventStore\\PostgreSqlEventStorePositionStorageConfiguration;\n\n$connection = DriverManager::getConnection([\n    'url' =\u003e '...'\n], new Configuration()); \n\n$config = new PostgreSqlEventStorePositionStorageConfiguration();\n$store = new PostgreSqlEventStorePositionStorage($connection, $config);\n```\n\n\n### PostgreSqlEventProcessor\nA ready-made implementation of an Event Processor with support for the `PostgreSqlEventStore`\nis also provided with this component:\n\n```php\nuse Morebec\\Orkestra\\PostgreSqlEventStore\\PostgreSqlEventProcessor;\n$processor = new PostgreSqlEventProcessor($publisher, $eventStore, $postgreSqlEventStore, $positionStorage);\n\n// This call will loop and notify all event store subscribers as well as the event processor itself\n// for event tracking.\n$processor-\u003estart();\n```\n\n\u003e Given that the `EventStoreInterface` can be decorated, the processor cannot directly use the `PostgreSqlEventStore` through the `EventStoreInterface`.\n\u003e Also, since it requires using specific methods from the implementation `PostgreSqlEventStore`  to access some PostgreSQL specific features,\n\u003e the actual instance of the `PostgreSqlEventStore` must be injected additionally. \n\u003e This is why both are injected in the constructor.\n\n## Testing\nTo run the tests execute the following command:\n```shell\nvendor/bin/phpunit tests/\n```\n\nIt is required to have an instance of postgresql running with a password-less role `postgres` and a database named `postgres`.\nTo easily get this setup and running a `docker-compose` configuration file is available at the root of this project.\n\nTo run it simply execute the following command:\n\n```shell\ndocker-compose up -d\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmorebec%2Forkestra-postgresql-eventstore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmorebec%2Forkestra-postgresql-eventstore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmorebec%2Forkestra-postgresql-eventstore/lists"}