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 Document Store Laravel Package

event-engine/php-document-store

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Standardization Across Microservices: Enables consistent document storage interfaces across Laravel-based microservices, reducing technical debt from ad-hoc implementations (e.g., custom MongoDB/PostgreSQL adapters). Aligns with modular architecture goals.
  • Event-Sourcing/CQRS Roadmap: Critical for projects adopting event-driven architectures where documents act as read models or event snapshots. Integrates seamlessly with event-engine/persistence for projection pipelines.
  • Build vs. Buy Decision:
    • Buy: Use the package’s contract + in-memory store for testing and prototyping.
    • Build: Extend the contract to create custom backends (e.g., Elasticsearch, DynamoDB) or Laravel-specific adapters (e.g., Eloquent integration).
    • Avoid Reinventing: Eliminates need to build CRUD/indexing logic from scratch.
  • Key Use Cases:
    • Testing: In-memory store replaces mocking in unit/integration tests, improving reliability (e.g., testing event projections).
    • Multi-Environment Deployments: Switch between in-memory (dev), PostgreSQL (staging), and custom stores (prod) without code changes.
    • Partial Updates: Methods like replaceDoc and getPartialDoc optimize high-frequency writes (e.g., user profile updates) by avoiding full document merges.
    • Indexing: Named indices and unique constraints enable efficient querying (e.g., filterDocIds), reducing reliance on external search layers like Elasticsearch for simple use cases.

When to Consider This Package

  • Adopt if:

    • Your Laravel application uses event sourcing, CQRS, or DDD and needs a standardized document store for read models or projections.
    • You require multi-backend support (e.g., in-memory for CI, PostgreSQL for production) with zero code changes in business logic.
    • Your team prioritizes testability and wants to eliminate mocking complexity for document-heavy workflows.
    • You need fine-grained document operations (e.g., partial updates, conditional filters) without recursive merges (common in JSON-based stores).
    • You’re already using or planning to use event-engine/persistence for event storage and want alignment in your read model layer.
    • Your documents are moderate in size (not petabyte-scale) and don’t require advanced analytics (e.g., full-text search, geospatial queries).
  • Look Elsewhere if:

    • You’re not using PHP/Laravel or need a managed service (e.g., Firebase, AWS DynamoDB).
    • Your documents are extremely large (e.g., binary blobs) or require real-time sync (consider Pusher, Socket.io, or Laravel Echo).
    • You need offline-first capabilities (this package is backend-only; pair with Laravel Sanctum or Passport for client-side auth).
    • Your team lacks PHP expertise or prefers a batteries-included solution (e.g., Laravel Scout for search, Eloquent for relational data).
    • You require complex aggregations (e.g., time-series data) and would rather use PostgreSQL with jsonb or a dedicated OLAP tool.

How to Pitch It (Stakeholders)

For Executives: *"This package lets us standardize how we store and retrieve documents across our Laravel services—whether for testing, event sourcing, or production—without locking us into a single database. Think of it as a universal adapter for document storage:

  • Today: Use in-memory storage for fast, reliable tests.
  • Tomorrow: Scale to PostgreSQL or other backends with minimal code changes.
  • Long-term: Avoid technical debt from custom document storage logic.

It’s low-risk (MIT license, minimal dependencies) and high-reward for consistency and maintainability. The cost? A small upfront effort to integrate it—paying off in faster development cycles and easier scaling."*

For Engineering: *"This is a contract-first document store that gives us:

  • Flexibility: Swap storage backends (e.g., in-memory → PostgreSQL) by implementing the DocumentStore interface—no business logic changes.
  • Testing Superpowers: The built-in in-memory store eliminates mocking for document-heavy workflows (e.g., event projections). Write tests that run in milliseconds, not hours.
  • Modern Features:
    • Partial updates (replaceDoc) avoid messy recursive merges.
    • Unique indices and conditional filters (AndFilter, OrFilter) enable efficient queries without external search layers.
    • Laravel Synergy: Integrates with the service container, Eloquent, and caching for hybrid architectures.
  • Event Engine Alignment: Plays nicely with event-engine/persistence if we’re using it, reducing friction in event-sourcing pipelines.

Tradeoffs:

  • We’ll need to write adapters for our preferred backends (e.g., Elasticsearch, DynamoDB), but the contract handles 80% of the boilerplate.
  • The in-memory store isn’t production-ready for high throughput, but we can benchmark against Laravel’s cache or database for critical paths.

Recommendation: Start with the in-memory store for testing and PostgreSQL for production, then extend to other backends as needed. This gives us immediate value while keeping options open."*

For Architects: *"This package addresses three critical gaps in Laravel’s ecosystem:

  1. Lack of a Standard Document Store Contract: Unlike Eloquent (relational) or Scout (search), there’s no first-class document store for JSON/NoSQL-like data. This fills that gap with a minimal, extensible interface.
  2. Testing Pain Points: Mocking document stores is error-prone and slow. The in-memory implementation provides a realistic test double with zero mocking overhead.
  3. Multi-Backend Complexity: Switching between PostgreSQL (prod), SQLite (local), and MongoDB (legacy) requires duplicative logic. This contract abstracts the differences.

Integration Strategy:

  • Use Laravel’s service container to bind the interface to implementations (e.g., PostgresDocumentStore in production, InMemoryDocumentStore in tests).
  • For event sourcing, pair with event-engine/persistence to project events into documents.
  • Extend the contract to add Laravel-specific features (e.g., Eloquent model sync, query builder integration).

Risk Mitigation:

  • Circular Dependencies: Isolate the in-memory store behind a factory or use composer’s replace for local dev.
  • Performance: Benchmark against Laravel’s cache or database for write-heavy workloads.
  • BC Breaks: Pin versions in composer.json and use migration scripts for upgrades.

Outcome: A scalable, testable document layer that reduces coupling and accelerates feature delivery."*

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.
besmartand-pro/php-quality-config
sentix/ai-chatbot
terminal42/code-quality-tools
codifyo/ts-generator-bundle
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity