Search by

johnnyxlemonade / admin-cms-news

johnnyxlemonade

Reusable localized CMS news module for Lemonade Admin.

Package info

github.com/johnnyxlemonade/admin-cms-news

pkg:composer/johnnyxlemonade/admin-cms-news

Statistics

Installs: 2

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

1.0.0 2026-12-03 13:51 UTC

This package is auto-updated.

Last update: 2026-12-03 13:52:28 UTC


README

Tests PHP 8.3–8.6 PHPStan License

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.

License

Apache License 2.0