Download the PHP package kraz/read-model without Composer
On this page you can find all versions of the php package kraz/read-model. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package read-model
Read Model
A domain-first Read Model library that provides a uniform API for querying read-only data from multiple backends. Define your query logic once; plug in Doctrine ORM, raw SQL, JSON-RPC APIs, or Elasticsearch — or use the built-in in-memory implementation for fast, dependency-free tests.
Installation
Additional packages
Install any of the following packages which matches your infrastructure requirements:
| Package | Description |
|---|---|
| kraz/read-model-doctrine | Doctrine ORM & raw SQL backend |
| kraz/read-model-json-rpc | JSON-RPC 2.0 API backend (expects read-model exposed as API) |
| kraz/read-model-elastic-search | Elasticsearch backend |
Documentation
Full documentation lives in the docs/ directory:
- Getting Started
- Core Concepts
- Filtering & Sorting
- Pagination & Limits
- Specifications
- Testing
- Doctrine Backend
- JSON-RPC Backend
- Elasticsearch Backend
Example usage
Raw SQL
The /*#WHERE#*/ placeholder is replaced automatically with WHERE <generated conditions> when a filter is applied, and removed cleanly otherwise. The /*#ORDERBY_B#*/ ... /*#ORDERBY_E#*/ section wraps a default sort expression: it is used as is when nothing is applied and replaced by the generated sort when the caller sorts. The ORDER BY keyword stays outside the section. See Doctrine for the details.
ORM QueryBuilder
Querying
Both styles share the same query API:
The query expression is serializable and can be stored and/or transferred as needed.
Acknowledgements
The library uses source code from Doctrine Collections which was modified to meet the required behavior.
License
This library is licensed under the MIT License. See the LICENSE file for details.
All versions of read-model with dependencies
php Version >=8.4