Download the PHP package contenir/contenir-db-model without Composer
On this page you can find all versions of the php package contenir/contenir-db-model. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download contenir/contenir-db-model
More information about contenir/contenir-db-model
Files in contenir/contenir-db-model
Package contenir-db-model
Short Description Attribute-mapped, typed-property data mapper built on php-db/phpdb
License BSD-3-Clause
Homepage https://contenir.com.au
Informations about the package contenir-db-model
contenir-db-model
A small data mapper for php-db/phpdb.
Entities are plain PHP classes with typed properties, described by
attributes. There are no base classes and no magic __get/__set.
- Attribute mapping. Tables, columns, keys, versions and relations are declared on the class and validated up front.
- Typed values. Enums, dates, JSON, booleans and secrets are converted in both directions.
- An entity manager with an identity map, changed-column updates, optimistic locking and re-entrant transactions.
- Repositories with validated criteria, streaming and custom phpdb selects.
- Lazy relations, plus
preload()to avoid N+1 queries.
Status: 2.0 pre-release. 2.0 is a rewrite and is not compatible with 1.x. See UPGRADE-2.0.md. 1.x remains available from the
v1.0.*tags.
Requirements
- PHP 8.3, 8.4 or 8.5
php-db/phpdb0.6, plus the platform package for your database, such asphp-db/phpdb-mysqlorphp-db/phpdb-sqlitepsr/container,psr/simple-cache1.x, 2.x or 3.x
Installation
The latest development version is v2.x-dev. Until php-db/phpdb 0.6.0
and this package's 2.0.0 are tagged, the consuming project needs "minimum-stability": "dev" and
"prefer-stable": true.
With laminas/laminas-component-installer, the ConfigProvider (Mezzio)
or Module (laminas-mvc) is registered automatically. See
container integration for configuration.
At a glance
Documentation
Read in this order:
- Mapping entities: attributes, keys, validation rules
- Type conversion: built-in and custom converters, nulls
- Persisting entities:
EntityManagersaves, deletes, locking and transactions - Repositories and finders: criteria, streaming, custom queries and repositories
- Relations: lazy collections,
LazyRelationsTrait,preload() - Identity map: one object per row, and memory in long-running processes
- Entity lifecycle: hydration, refresh and change tracking in detail
- Sensitive data:
SensitiveStringand redaction - Metadata caching: PSR-16 cache for production
- Container integration: configuration, factories, entity manager lifetime
Upgrading from 1.x: UPGRADE-2.0.md. Changes: CHANGELOG.md.
Console tools for generating entities from tables, upgrading 1.x entities and validating mappings against the schema are in contenir-db-model-tools.
llms.txt indexes these pages and lists the key rules for LLM
tooling.
Development
Mago is required. It is a standalone binary, installed with brew install mago or see the Mago docs.
The integration suite runs against in-memory SQLite by default. To run it
against MySQL or PostgreSQL, set DB_PLATFORM (and DB_HOST, DB_PORT,
DB_NAME, DB_USER, DB_PASSWORD as needed). compose.yml starts both
databases:
Every test recreates the fixture schema, including a crm schema or
database, so use a disposable database and a user allowed to create it.
CI runs the suite on SQLite, MySQL 8.4 and PostgreSQL 17.
test-coverage-branches runs each test directory in its own process and
merges the results, because Xdebug 3.4's --path-coverage intermittently
crashes on long runs. Pass -- --clover clover.xml or
-- --html build/coverage for report files.
QA configuration comes from php-db/phpdb-qa-tools.
License
BSD-3-Clause. See LICENSE.md.
All versions of contenir-db-model with dependencies
php-db/phpdb Version 0.6.x-dev
psr/container Version ^1.1 || ^2.0
psr/simple-cache Version ^1.0 || ^2.0 || ^3.0