Download the PHP package eril/db-model-entity without Composer
On this page you can find all versions of the php package eril/db-model-entity. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download eril/db-model-entity
More information about eril/db-model-entity
Files in eril/db-model-entity
Package db-model-entity
Short Description A lightweight, fluent, and efficient database toolkit separating query logic from data mutations.
License MIT
Informations about the package db-model-entity
DBME (Database Model Entity)
A lightweight, fluent, and highly efficient PHP Database Toolkit designed to separate raw CRUD persistence operations from advanced data querying. By splitting responsibilities into distinct execution layers, DBME gives you Active Record features without the overhead or architectural pollution of typical heavy ORMs.
Key Architectural Concepts
Unlike monolith ORMs, DBME isolates its database operations into three specialized architectural pillars via a unified entry facade:
SqlExecutor(Direct CRUD): Handles targeted database write routines (create,update,delete) and primary key lookups without builder baggage.ModelQuery(Advanced Querying): A fluent, stateful query builder dedicated entirely to complex data filtration, aggregations, and subquery isolation (e.g., smart counting withGROUP BY).Entity&EntityCollection(Domain Layer): Encapsulates single rows into memory-efficient objects equipped with active dirty-state tracking (preventing redundant database roundtrips) and rich array capabilities.
Architecture Overview
Installation
Install the package via Composer (adjust repository path as needed):
Quick Start & Usage
1. Connection Initialization
You can initialize a brand new standalone PDO instance directly or register an existing connection/lazy-loading closure (ideal for framework integrations).
2. Standard CRUD Operations (::table)
Use the table entry point when mutating data or performing explicit row mutations. It returns a dedicated SqlExecutor instance.
3. Advanced Querying (::query)
Use the query entry point when you need a fluent query builder interface, conditional filters, pagination, or database calculations. It returns a ModelQuery instance.
4. Active Record & Memory Snapshots (Entity)
When an Entity is loaded from the database, it captures an internal snapshot of its database state. Calling update() executes dirty-checking to compile an optimal SQL payload, updating only mutated properties.
5. Collection Operations (EntityCollection)
The EntityCollection provides high-utility, in-memory array manipulation tools without querying the database server redundantly.
6. Atomic Database Transactions
Wrap complex, cross-table mutation streams securely inside database transactions. Any uncaught exception automatically rolls back changes.
Code Quality Standards
This library is designed keeping static analysis tools (PHPStan, Psalm) in mind. All classes include strict inline generics documentation, precise typehints, and clear object property mappings.
License
This toolkit is open-sourced software licensed under the MIT License.
All versions of db-model-entity with dependencies
ext-pdo Version *
ext-json Version *