phramecms / entity
Dynamic Entity Types, Bundles, reusable Field Storage & Field Instances, pluggable Field Types, Revisions, and Editorial Workflow States for PhrameCMS.
v0.1.0
2026-12-04 21:11 UTC
Requires
- php: ^8.5
- phramecms/config: ^0.1
- phramecms/core: ^0.1
- phramecms/database: ^0.1
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.95
- infection/infection: ^0.35.12
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^13.0
- spaze/phpstan-disallowed-calls: ^4.15
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-12-04 21:34:49 UTC
README
Dynamic Entity and Drupal-inspired Field module for PhrameCMS.
Responsibilities
- Config-Driven Entity Types & Bundles: Define entity types (e.g.,
content,media,taxonomy_term) and bundles (e.g.,article,page,product) as validated configuration objects inphramecms/config. - Drupal-Inspired Field Architecture:
FieldStorage: Reusable field definition (field type, storage settings, cardinality1,N, or unlimited) shared across bundles of an entity type.FieldInstance: Bundle-specific attachment with label, description, required flag, default value, validation constraints, and API exposure metadata.
- Pluggable Field Types (via
phrame.field_typeservice tag):- Built-in types:
string,text(formatted/markdown),integer,float,boolean,datetime,json,slug, andentity_reference. - Each field type declares its own storage column schema, normalization/denormalization logic, validation rules, and JSON Schema fragment.
- Built-in types:
- Revisions & Editorial Workflow:
- Immutable revision history for every entity change with author/agent attribution and revision log message.
- Built-in workflow states (
draft,in_review,published,archived) so AI agents can be constrained to drafting without auto-publishing.
- Registered Operations: Schema operations (
entity_type.*,bundle.*,field_storage.*,field_instance.*) and content operations (entity.list,entity.get,entity.create,entity.update,entity.delete,entity.revisions,entity.transition) — all supporting validation anddry_run.
AI-First Design Role
Every bundle dynamically compiles a complete JSON Schema from its attached FieldInstance definitions. When an AI agent (or human) adds a field to a bundle, the REST API, OpenAPI 3.1 spec, MCP tools/resources, and CLI immediately reflect the updated schema.
Dependencies
- PHP
^8.5 phramecms/corephramecms/databasephramecms/config
Ecosystem
Part of the PhrameCMS multi-repo suite. See PhrameCMS/cms for the starter distribution and architecture docs.