clutch-property-mgmt / content-domain
Shared CMS domain models for PHP SSR apps. Provides pure, framework-agnostic entities (Page, PageSection, Review, SeoMeta, Navigation, etc.) with attribute-based validation via [phpolar/model]. Designed for Clean Architecture: no infrastructure, no PDO—just content-focused domain objects.
Installs: 41
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/clutch-property-mgmt/content-domain
Requires
- phpolar/model: ^2.2
- phpolar/validators: ^1.4
This package is not auto-updated.
Last update: 2026-02-23 03:42:28 UTC
README
Shared CMS domain models for PHP SSR apps. Provides pure, framework-agnostic entities (Page, PageSection, Review, SeoMeta, Navigation, etc.) with attribute-based validation via [phpolar/model]. Designed for Clean Architecture: no infrastructure, no PDO—just content-focused domain objects.
Table of Contents
- Goals
- What’s Included
- What’s Not Included
- Install
- Usage
- Directory & Namespaces
- Versioning
- Contributing
- License
Goals
- Pure domain for CMS/content concerns
- Reusable across
storefront(read-only) andstorefront-admin(read-write) - Stable contracts with small, composable objects
- Validation via attributes using
phpolar/model - Zero infrastructure: no PDO, no frameworks, no I/O side effects
What’s Included
- Core CMS entities and value objects:
Page,PageSection,Block,SeoMeta,Slug,Navigation,MenuItem,Review(example set)
- Attribute-based rules for validation/normalization
- Minimal helpers for content-domain business rules (publishability, visibility windows, etc.) that do not perform I/O
What’s Not Included
- No repositories, PDO, or persistence code
- No controllers or framework glue
- No caching, logging, HTTP, or config loading
Keep infrastructure in the application layer (e.g.,
storefront,storefront-admin). This package should remain framework- and storage-agnostic.
Install
composer require clutch-property-mgmt/content-domain
Requires PHP 8.2+ and
phpolar/model.
Usage
Entities
<?php use ContentDomain\Content\Page; use ContentDomain\Content\SeoMeta; use ContentDomain\Content\PageSection; $seo = new SeoMeta(title: 'Apartments in Midtown', description: 'Spacious, modern units', keywords: ['apartments','midtown']); $page = new Page( id: null, slug: 'midtown-apartments', title: 'Midtown Apartments', sections: [ new PageSection('hero', ['headline' => 'Live in Midtown']) ], seo: $seo, publishedAt: new \DateTimeImmutable('2025-01-01T00:00:00Z'), );
Validation with phpolar/model
Use PHP attributes from phpolar/model on properties to enforce constraints.
<?php use Phpolar\Model\Attributes as Assert; final class Slug { public function __construct( #[Assert\NotBlank] #[Assert\Pattern('/^[a-z0-9-]+$/')] public readonly string $value, ) {} }
Immutability / Value semantics
Favor immutable value objects (e.g., Slug, SeoMeta) and explicit methods to derive new instances rather than in-place mutation. Entities may carry identifiers; value objects should not.
Directory & Namespaces
src/
Content/
Page.php
PageSection.php
SeoMeta.php
Slug.php
Review.php
Navigation.php
MenuItem.php
Validation/
(attribute helpers, if any)
- Root namespace:
ContentDomain\\... - Public API is limited to types under
ContentDomain\Contentand documented helpers.
Versioning
- Semantic Versioning (SemVer): MAJOR.MINOR.PATCH
- Breaking changes only in MAJOR releases
Contributing
- Fork and create a feature branch
- Add tests and docs
- Ensure CI passes (coding standards, static analysis, unit tests)
- Open a PR with a clear description and rationale
License
MIT License. See LICENSE for details.