orbis-cms / articles
Reusable articles module for Orbis CMS.
Requires
- php: ^8.3
- laravel/framework: ^13.0
- orbis-cms/core: 0.0.*
- orchid/platform: ^14.0
Requires (Dev)
- laravel/pint: ^1.24
- orchestra/testbench: ^11.0
- phpunit/phpunit: ^12.0
This package is auto-updated.
Last update: 2026-08-10 20:12:58 UTC
README
An articles module for Orbis CMS. It provides article and category models, an Orchid admin interface, public pages, SEO integration, and ready-to-use Blade components.
Installation
Install the package and run its migrations:
composer require orbis-cms/articles
php artisan vendor:publish --tag=orbis-cms-articles-migrations
php artisan migrate
Publish the configuration:
php artisan vendor:publish --tag=orbis-cms-articles-config
Article author
The default author model is Laravel's App\Models\User. If the host application uses a different model or attribute names, update config/orbis-cms-articles.php:
'author' => [
'model' => App\Models\User::class,
'id' => 'id',
'name' => 'name',
],
The author model is required. An invalid configuration raises an exception instead of silently hiding the author field.
Admin interface
Once installed, the package adds these Orchid menu items:
- Articles — create, edit, delete, publication date, author, category, and images.
- Article categories — create, edit, and delete categories.
The following permissions are available:
orbis-cms-articles.articles
orbis-cms-articles.categories
Articles and categories have linked CMS pages. Their editors provide SEO fields, publication controls, URI changes, redirects, and homepage assignment, just like other Orbis CMS pageable models.
Public pages
The package registers page handlers for Article and ArticleCategory. Create their URLs through PageService:
$article = Article::create([...]);
app(PageService::class)->createFor($article);
$category = ArticleCategory::create([...]);
app(PageService::class)->createFor($category);
Configure the URI prefix with:
'page' => [
'uri_prefix' => 'articles',
],
An article is available only when its CMS page is published and its scheduled_at time has passed. Category listings and the general articles list only show available articles.
Views
The package ships with these default views:
orbis-cms-articles::article— article page;orbis-cms-articles::category— category page;orbis-cms-articles::article-card— article card.
To override them in the host application:
php artisan vendor:publish --tag=orbis-cms-articles-views
The templates are published to resources/views/vendor/orbis-cms-articles and automatically override the package views.
Translations
Publish the package translations to customize the interface copy:
php artisan vendor:publish --tag=orbis-cms-articles-translations
The files are published to lang/vendor/orbis-cms-articles.
Articles list component
Use this Blade component to render all published and available articles:
<x-orbis-cms-articles::articles />
Set the page size explicitly when needed:
<x-orbis-cms-articles::articles :per-page="6" />
The default is configured by orbis-cms-articles.pagination.per_page and is 12.
Models and presenters
Article and ArticleCategory implement the Pageable contract and support replacement through the core ModelRegistry.
Use an article presenter for public output:
$presenter = $article->presenter();
$presenter->title();
$presenter->excerpt();
$presenter->body();
$presenter->authorName();
$presenter->scheduledAt();
$presenter->images();
$presenter->url();
Use these scopes to query visible articles:
Article::query()
->published()
->orderedByPublicationDate()
->get();
published() excludes drafts and articles with a future scheduled_at. orderedByPublicationDate() sorts by scheduled_at, falling back to created_at for ordinary articles.
Checks
composer pint
composer test