liberusoftware / module-cms-content-types
Custom content types for Liberu CMS: JSON field schemas and validated content entries with workflow and versioning.
Package info
github.com/liberusoftware/module-cms-content-types
Type:liberu-module
pkg:composer/liberusoftware/module-cms-content-types
Requires
- php: ^8.5
- illuminate/contracts: ^13.38.0
- illuminate/database: ^13.38.0
- illuminate/support: ^13.38.0
- liberusoftware/module-cms-content: ^0.1
- liberusoftware/module-cms-contracts: ^0.1
- liberusoftware/module-cms-core: ^0.1
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-11-14 19:55:15 UTC
README
Repository
Source, issues, and release history: https://github.com/liberusoftware/module-cms-content-entities
Composer package: https://packagist.org/packages/liberusoftware/module-cms-content-entities
Custom content types for Liberu CMS — define your own content shapes (portfolio items, products, case studies, docs) with a JSON field schema, then create validated, workflow-enabled entries against them.
Built on the cms-content foundation (workflow + versioning).
Models
ContentType—key, labels, and afieldsJSON schema.fieldDefinitions()returns the schema asFieldDefinitionvalue objects.ContentEntry— belongs to a type;data(JSON) holds the field values.HasWorkflow+HasRevisions, auto-slug from title. Reports its type'skeyas the content type in workflow events.
Field schema
FieldType: text, textarea, richtext, number, boolean, date,
select, media. Each FieldDefinition has a name, label, type, required
flag, and (for select) options.
Validation
SchemaValidator::validate($type, $data) enforces the schema — required fields
present, values roughly matching their type — and drops keys not in the schema,
throwing InvalidContentData on violation.
$type = ContentType::create([ 'key' => 'portfolio', 'name' => 'Portfolio', 'singular_label' => 'Item', 'plural_label' => 'Items', 'fields' => [ ['name' => 'summary', 'label' => 'Summary', 'type' => 'text', 'required' => true], ['name' => 'year', 'label' => 'Year', 'type' => 'number'], ], ]); $data = app(SchemaValidator::class)->validate($type, ['summary' => 'A project', 'year' => 2026]); $entry = ContentEntry::create(['content_type_id' => $type->id, 'title' => 'A project', 'data' => $data]); $entry->publish();
Repository
ContentEntryRepositoryInterface: find, findBySlug, ofType(key), published.
Events
- Emits: via the content foundation —
ContentStateChanged,ContentPublished(carrying the custom type's key). - Listens: none.