johnnyxlemonade / admin-cms-news
Reusable localized CMS news module for Lemonade Admin.
Requires
- php: >=8.3
- johnnyxlemonade/admin-platform: ^1.0
- johnnyxlemonade/cms-core: ^1.0
- johnnyxlemonade/framework: ^1.0
- psr/http-message: ^2.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.94
- phpstan/phpstan: ^2.3
- phpstan/phpstan-strict-rules: ^2.1
- phpunit/phpunit: ^12.5
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Manage localized news in Lemonade Admin, including publication dates, recommendations, SEO, tags and media. The host renders public articles and lists.
Requirements
- PHP 8.3 or newer, tested on PHP 8.3–8.6.
- Lemonade Framework, Admin Platform and CMS Core
^1.0.
Installation
composer require johnnyxlemonade/admin-cms-news:^1.0
Composer discovers the module automatically. Run the host's migrations,
permission sync and Admin asset publication, then grant the module permissions
to the appropriate roles. Open <admin-base>/cms/news to manage news.
Public news
Inject PublishedNewsReadModel and pass
the PublicLocaleResolution from CMS routing.
$article = $news->record($articleId, $locale); $page = $news->collection( locale: $locale, page: $pageNumber, perPage: 12, tag: $tag, search: $query, publishedAt: ['from' => '2026-01-01', 'to' => '2026-12-31'], sortBy: 'publishedAt', sortDirection: 'desc', ); foreach ($page->getItems() as $item) { $title = $item->getTitle(); $url = $item->getPublicUrl(); $thumbnail = $item->getThumbnail(); } $pagination = $page->getPagination('/news', query: ['tag' => $tag]);
Reads return active articles with a published translation in an enabled locale
once its publication time is reached and its canonical route is active.
Use latest(), recommended() or others()
for short lists and languageAlternatives() for localized canonical URLs.
sitemapEntries() supplies URLs and update times for the host's sitemap.
isPublicInAnyLocale() checks whether a file's article owner is public.
Development
composer install composer qa
Database integration tests run separately against a dedicated
cms_news_test_* database.