johnnyxlemonade / cms-core
Reusable public CMS route runtime for Lemonade.
Requires
- php: >=8.3
- johnnyxlemonade/framework: ^1.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.94
- nyholm/psr7: ^1.8
- phpstan/phpstan: ^2.3
- phpstan/phpstan-strict-rules: ^2.1
- phpunit/phpunit: ^12.5
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
CMS Core provides the shared content lifecycle, canonical URLs and locale-aware public routing for Lemonade CMS modules. The host supplies public handlers and renders the responses.
Features
- Locale resolution, canonical route reservation and request-scoped lookup.
- Shared draft, publication, ownership and audit lifecycle.
- Reusable editor reads and publication scopes for content modules.
Requirements
- PHP 8.3 or newer, tested on PHP 8.3–8.6.
- Lemonade Framework
^1.0.
Installation
composer require johnnyxlemonade/cms-core:^1.0
Register CmsCoreServiceProvider and bind
PublicLocaleRegistryInterface and PublicModuleStateResolverInterface in the host.
Run the host migrations to create the canonical route index.
Public routing
Register a PublicCmsRouteHandlerInterface for each module the host renders.
The route resolver checks the locale, canonical path and module availability.
The handler checks whether the localized record is public.
PublicCmsRouteResolver::currentRoute()
shares the canonical lookup with dispatch.
Module integration
CmsContentDefinition configures the root
table, translations and localized paths. Use rootScope() for a partition in
a shared root table.
$moduleCode = $definition->getModuleCode(); $rootTable = $definition->getRootTable(); $hasBody = $definition->hasBodyColumns(); $pathPrefix = $definition->routePrefix('cs');
- CmsContentReadModel supplies editor reads,
owner lookup, translations and tag suggestions. Domain columns come from
CmsRootandCmsLocalizedattributes. - PublishedContentScope supplies the shared publication query and canonical language alternatives for routed content.
- PublishedContentInterface gives host renderers one contract for identity, title, locale, canonical URL and SEO across CMS Page, Content Types and News.
- PublishedPresentation exposes editorial display settings and calculates reading time for Content Types and News. Host views choose how to render those values.
- CmsContentValueWriter lets a module validate and save its own field values in the existing lifecycle transaction.
Development
composer install composer qa