Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Php Postgres Document Store

Php Postgres Document Store Laravel Package

event-engine/php-postgres-document-store

PostgreSQL-backed document store for Event Engine (PHP). Store, update, and query JSON documents efficiently using Postgres features like JSONB and indexes. Designed for read models/projections with a simple API and solid performance.

View on GitHub
Deep Wiki
Context7

Postgres Document Store for Event Engine

Frequently asked questions about Php Postgres Document Store
Can I use this package with Laravel’s Eloquent ORM for event queries?
No, this package doesn’t integrate directly with Eloquent. You’ll need to use raw PostgreSQL queries via Laravel’s DB facade or build a custom repository layer. For frequent event queries, consider extending Eloquent to support JSONB fields manually.
What Laravel versions does this package support?
The package targets PHP 8.0+ and is designed for Laravel 9/10. Check the GitHub repo for exact version constraints, as it depends on Event Engine’s abstractions, which may have their own Laravel version requirements.
How do I handle event sourcing transactions with this store?
Use PostgreSQL transactions via Laravel’s DB facade to ensure atomicity between event appends and projections. Wrap your operations in `DB::transaction()` to maintain consistency. Example: `DB::transaction(fn() => $store->append($event));`
Does this package support optimistic concurrency control?
No, the package doesn’t enforce optimistic concurrency out of the box. You’ll need to implement it manually, such as adding a `version` field to your events and checking it before updates. PostgreSQL’s `FOR UPDATE SKIP LOCKED` can help with pessimistic locking.
Can I query nested JSON fields in stored events?
Yes, the package leverages PostgreSQL’s JSONB operators (e.g., `->`, `->>`, `@>`) for nested queries. Example: `SELECT * FROM events WHERE event_data->'user'->>'id' = '123'`. Index these paths for performance.
How does this compare to using MongoDB for event storage?
This package avoids vendor lock-in to MongoDB while retaining JSON flexibility. PostgreSQL offers ACID transactions, SQL querying, and built-in full-text search—ideal for read models. However, MongoDB may be simpler for unstructured data or horizontal scaling.
What’s the performance impact of storing events as JSONB?
JSONB queries can be slower than native relational columns, especially for deep nesting. Benchmark with your event volume (e.g., 10K events/sec) and index frequently queried paths. For high-throughput systems, consider denormalizing critical fields.
How do I integrate this with Laravel’s event system (e.g., `dispatch()`)?
Wrap the package in a Laravel service provider to expose an `EventStore` interface. Then, bind it to Laravel’s container and use dependency injection. Example: `$eventStore = app(EventEnginePostgresStore::class); $eventStore->append($event);`
Are there tools for debugging or inspecting stored events?
No built-in Laravel tooling exists. Use PostgreSQL’s `pgAdmin` or CLI tools (`psql`) to inspect tables. For Laravel-specific debugging, create custom Artisan commands or admin panels to query the `event_store` table.
How do I handle schema evolution for dynamic event attributes?
PostgreSQL’s JSONB schema is backward-compatible, so adding new fields won’t break reads. For migrations, use Laravel’s schema builder to alter tables if needed. Forward-compatibility risks arise if your code assumes fixed event structures—validate dynamically.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
milito/query-filter
apiboxsym/user-bundle
apiboxsym/health-check-bundle
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui
babelqueue/php-sdk
facebook/capi-param-builder-php
babelqueue/symfony
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours