Download the PHP package websk/php-entity without Composer
On this page you can find all versions of the php package websk/php-entity. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download websk/php-entity
More information about websk/php-entity
Files in websk/php-entity
Package php-entity
Short Description Entity, repository, service, caching, and ordering primitives for WebSK applications
License MIT
Informations about the package php-entity
php-entity
websk/php-entity provides base entity, repository, service, caching, and weight-ordering primitives for WebSK applications.
Requirements
- PHP 8.3, 8.4, or 8.5
- PDO
websk/php-cache3.0websk/php-db3.0websk/php-utils3.0
Installation
Entity definition
An entity implements InterfaceEntity, declares its database table, and defines one protected property for each persisted field. Entity supplies the nullable integer ID and creation timestamp.
Create a repository by extending EntityRepository and passing the entity class and a configured DBService:
EntityRepository expects the table to contain the entity ID field (id by default) and matching columns for persisted properties. Define DB_ID_FIELD_NAME on the entity to use another ID column.
Services and caching
Extend EntityService to add cache-backed reads and transactional save/delete operations. The service requires the entity class, its repository, and a configured CacheService.
The service validates cached values before returning them. Save and delete operations roll back transactions on any throwable failure in repository or lifecycle hooks.
Missing database fields
By default, loading or saving a database field without a matching entity property raises an exception. Legacy schemas can opt into ignoring such fields:
Weight ordering
Entities that implement InterfaceWeight can use WeightTrait, WeightRepository, and WeightService to initialize weights and swap adjacent items within an optional field context.
Development
composer check runs syntax checks, PHPUnit, and PHPStan at level max.
All versions of php-entity with dependencies
ext-pdo Version *
websk/php-cache Version 3.0.*
websk/php-db Version 3.0.*
websk/php-utils Version 3.0.*