PHPackages                             azaharizaman/nexus-content - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Admin Panels](/categories/admin)
4. /
5. azaharizaman/nexus-content

ActiveLibrary[Admin Panels](/categories/admin)

azaharizaman/nexus-content
==========================

Framework-agnostic knowledge base and content management package with versioning, workflow, and multi-language support

v0.1.0-alpha1(1mo ago)00MITPHPPHP ^8.3

Since May 5Pushed 1mo agoCompare

[ Source](https://github.com/azaharizaman/nexus-content)[ Packagist](https://packagist.org/packages/azaharizaman/nexus-content)[ RSS](/packages/azaharizaman-nexus-content/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

Nexus Content
=============

[](#nexus-content)

[![PHP Version](https://camo.githubusercontent.com/ef0054230522e542bc1f908ac005c6c75888dea255bac910f9015e12095e31d7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253545382e332d626c7565)](https://www.php.net/)[![License](https://camo.githubusercontent.com/f8df3091bbe1149f398a5369b2c39e896766f9f6efba3477c63e9b4aa940ef14/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e)](LICENSE)

**Framework-agnostic knowledge base and content management package with versioning, workflow, and multi-language support.**

Overview
--------

[](#overview)

`Nexus\Content` provides a comprehensive, stateless content management engine for building knowledge bases, documentation systems, help centers, and internal wikis. The package implements progressive disclosure across three levels:

- **Level 1 (MVP)**: Basic article creation, publishing, and search integration
- **Level 2 (Professional)**: Version control, review workflow, hierarchical categories
- **Level 3 (Enterprise)**: Scheduled publishing, content locking, multi-language support, access control

Key Features
------------

[](#key-features)

✨ **Comprehensive Version Control**

- Immutable version history with full audit trail
- Draft → Pending Review → Published → Archived workflow
- Compare any two versions with built-in diff generator

🌍 **Multi-Language Support**

- Translation groups linking related articles
- Language-specific content with fallback support
- Search filtering by language

🔒 **Enterprise-Grade Access Control**

- Public/private visibility toggle
- Party-based access control lists (integration with `Nexus\Party`)
- Content locking prevents simultaneous editing

📅 **Scheduled Publishing**

- Set future publish dates for content versions
- Automatic publishing via background workers (application layer)

🔍 **Powerful Search Integration**

- Framework-agnostic search interface
- Faceted search (category, language, permissions)
- Respects visibility and access control

📊 **Hierarchical Organization**

- Categories with up to 3 levels of nesting
- Logical content organization
- Category-based filtering

Installation
------------

[](#installation)

```
composer require azaharizaman/nexus-content:"*@dev"
```

Quick Start
-----------

[](#quick-start)

### 1. Create Your First Article

[](#1-create-your-first-article)

```
use Nexus\Content\Services\ArticleManager;
use Nexus\Content\ValueObjects\ArticleCategory;

// Inject dependencies (see Integration Guide)
$articleManager = new ArticleManager($repository, $searchEngine);

// Create category
$category = ArticleCategory::createRoot(
    categoryId: 'cat-001',
    name: 'Getting Started',
    slug: 'getting-started',
    description: 'Beginner guides and tutorials'
);

// Create article with initial draft
$article = $articleManager->createArticle(
    articleId: 'art-001',
    title: 'How to Get Started',
    slug: 'how-to-get-started',
    category: $category,
    textContent: '# Getting Started\n\nWelcome to our platform...',
    authorId: 'user-123',
    isPublic: true
);
```

### 2. Publish the Article

[](#2-publish-the-article)

```
// Publish latest draft
$publishedArticle = $articleManager->publish('art-001');

// Article is now searchable via ContentSearchInterface
```

### 3. Update Content (Creates New Version)

[](#3-update-content-creates-new-version)

```
$updatedArticle = $articleManager->updateContent(
    articleId: 'art-001',
    textContent: '# Getting Started\n\nUpdated content...',
    authorId: 'user-123'
);

// New draft version created, previous version preserved in history
```

### 4. Review Workflow

[](#4-review-workflow)

```
// Submit for review
$article = $articleManager->submitForReview('art-001');

// Approve and publish
$article = $articleManager->publish('art-001');
```

Core Concepts
-------------

[](#core-concepts)

### Articles

[](#articles)

Articles are the primary content containers. Each article:

- Has a unique slug for permanent URLs
- Belongs to a single category
- Contains multiple content versions (history)
- Can be public or restricted by access control
- Can be part of a translation group

### Content Versions

[](#content-versions)

Every change creates a new immutable version:

- Sequential version numbers (1, 2, 3...)
- Tracks author and creation time
- Has a lifecycle status (Draft → Pending Review → Published → Archived)
- Only Draft versions can be edited
- Only one Published version active at a time

### Categories

[](#categories)

Hierarchical organization up to 3 levels:

```
Level 1: Product Documentation
  Level 2: API Reference
    Level 3: Authentication

```

### Status Lifecycle

[](#status-lifecycle)

```
Draft → PendingReview → Published → Archived
  ↑           ↓              ↓
  └───────────┘──────────────┘

```

Usage Examples
--------------

[](#usage-examples)

### Level 1: Basic Operations

[](#level-1-basic-operations)

See [docs/examples/basic-usage.php](docs/examples/basic-usage.php) for complete examples.

```
// Create and publish in one flow
$article = $articleManager->createArticle(/* ... */);
$publishedArticle = $articleManager->publish($article->articleId);

// Get canonical URL
$url = $articleManager->getCanonicalUrl($article, 'https://kb.example.com');
// Returns: https://kb.example.com/kb/how-to-get-started
```

### Level 2: Version Control &amp; Workflow

[](#level-2-version-control--workflow)

```
// Create child category
$subCategory = ArticleCategory::createChild(
    categoryId: 'cat-002',
    name: 'API Reference',
    slug: 'api-reference',
    parentCategoryId: 'cat-001',
    parentLevel: 1
);

// Submit draft for review
$article = $articleManager->submitForReview('art-001');

// Compare versions
$diff = $articleManager->compareVersions(
    articleId: 'art-001',
    versionId1: 'v1',
    versionId2: 'v2'
);
// Returns: ['added' => [...], 'removed' => [...], 'unchanged' => [...]]
```

### Level 3: Enterprise Features

[](#level-3-enterprise-features)

```
// Schedule future publish
$article = $articleManager->createArticle(
    articleId: 'art-002',
    title: 'Product Launch',
    slug: 'product-launch',
    category: $category,
    textContent: '# New Product\n\nAvailable Q2 2025...',
    authorId: 'user-123',
    isPublic: true,
    options: [
        'scheduledPublishAt' => new \DateTimeImmutable('2025-06-01 09:00:00'),
    ]
);

// Lock for editing
$lockedArticle = $articleManager->lockForEditing(
    articleId: 'art-001',
    userId: 'user-123',
    durationMinutes: 30
);

// Create translation
$frenchArticle = $articleManager->createArticle(
    articleId: 'art-001-fr',
    title: 'Comment Commencer',
    slug: 'comment-commencer',
    category: $category,
    textContent: '# Comment Commencer...',
    authorId: 'user-123',
    isPublic: true,
    options: [
        'translationGroupId' => 'grp-001',
        'languageCode' => 'fr-FR',
    ]
);

// Access control
$restrictedArticle = $articleManager->createArticle(
    articleId: 'art-003',
    title: 'Internal Sales Guide',
    slug: 'internal-sales-guide',
    category: $category,
    textContent: '# Sales Team Only...',
    authorId: 'user-123',
    isPublic: false,
    options: [
        'accessControlPartyIds' => ['party-sales-team', 'party-management'],
    ]
);

// Faceted search
use Nexus\Content\ValueObjects\SearchCriteria;

$results = $articleManager->search(
    SearchCriteria::forParty('party-sales-team', 'pricing')
);
```

Available Interfaces
--------------------

[](#available-interfaces)

### `ContentRepositoryInterface`

[](#contentrepositoryinterface)

Repository for article persistence. Must be implemented by consuming application.

**Key Methods:**

- `saveArticle(Article $article): void` - Persist article
- `findById(string $articleId): ?Article` - Retrieve by ID
- `findBySlug(string $slug): ?Article` - Retrieve by slug
- `findVersionById(string $versionId): ?ContentVersion` - Get specific version
- `findTranslations(string $groupId): array` - Get all translations
- `isSlugAvailable(string $slug): bool` - Check slug uniqueness

### `ContentSearchInterface`

[](#contentsearchinterface)

Search engine integration. Implement with Elasticsearch, Algolia, Meilisearch, etc.

**Key Methods:**

- `indexArticle(Article $article): void` - Add/update search index
- `removeArticle(string $articleId): void` - Remove from index
- `search(SearchCriteria $criteria): array` - Faceted search
- `reindexAll(): int` - Batch reindexing

### `ArticleManager`

[](#articlemanager)

Main service for article operations.

**Key Methods:**

- `createArticle(...)` - Create new article
- `updateContent(...)` - Update (creates new version)
- `publish(...)` - Publish draft
- `submitForReview(...)` - Request approval
- `archive(...)` - Archive published article
- `lockForEditing(...)` - Prevent concurrent edits
- `compareVersions(...)` - Generate diff
- `search(...)` - Search articles
- `getTranslations(...)` - Get language versions

Application Layer Integration
-----------------------------

[](#application-layer-integration)

### Laravel Example

[](#laravel-example)

```
// app/Repositories/EloquentContentRepository.php
namespace App\Repositories;

use Nexus\Content\Contracts\ContentRepositoryInterface;
use Nexus\Content\ValueObjects\Article;
use App\Models\Article as ArticleModel;

final class EloquentContentRepository implements ContentRepositoryInterface
{
    public function saveArticle(Article $article): void
    {
        ArticleModel::updateOrCreate(
            ['article_id' => $article->articleId],
            [
                'title' => $article->title,
                'slug' => $article->slug,
                'category_id' => $article->category->categoryId,
                'is_public' => $article->isPublic,
                'version_history' => json_encode($article->versionHistory),
                // ... other fields
            ]
        );
    }

    public function findById(string $articleId): ?Article
    {
        $model = ArticleModel::where('article_id', $articleId)->first();

        if (!$model) {
            return null;
        }

        // Reconstruct Article value object from model
        return $this->hydrateArticle($model);
    }

    // ... implement other methods
}

// app/Providers/ContentServiceProvider.php
namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use Nexus\Content\Contracts\ContentRepositoryInterface;
use Nexus\Content\Contracts\ContentSearchInterface;
use App\Repositories\EloquentContentRepository;
use App\Services\MeilisearchContentSearch;

class ContentServiceProvider extends ServiceProvider
{
    public function register(): void
    {
        $this->app->singleton(ContentRepositoryInterface::class, EloquentContentRepository::class);
        $this->app->singleton(ContentSearchInterface::class, MeilisearchContentSearch::class);
    }
}
```

See [docs/integration-guide.md](docs/integration-guide.md) for complete examples.

Configuration
-------------

[](#configuration)

The package is stateless and requires no configuration files. All behavior is controlled via:

1. **Repository Implementation** - How articles are stored
2. **Search Implementation** - Which search engine to use
3. **Optional Integrations** - Audit logging, metrics, etc.

Testing
-------

[](#testing)

```
# Run package tests
cd packages/Content
composer test

# With coverage
composer test:coverage
```

Progressive Disclosure
----------------------

[](#progressive-disclosure)

The package implements three levels of functionality:

LevelFeaturesUse Case**L1: MVP**Create, publish, searchSimple knowledge base**L2: Professional**Version control, review workflow, categoriesContent team collaboration**L3: Enterprise**Scheduled publish, locking, multi-language, ACLLarge organizationsYou can adopt features progressively as your needs grow.

Package Architecture
--------------------

[](#package-architecture)

### Value Objects (Immutable)

[](#value-objects-immutable)

- `Article` - Aggregate root
- `ContentVersion` - Immutable version
- `ArticleCategory` - Hierarchical category
- `EditLock` - Concurrent editing prevention
- `SearchCriteria` - Faceted search parameters

### Services

[](#services)

- `ArticleManager` - Main business logic orchestrator

### Contracts (Interfaces)

[](#contracts-interfaces)

- `ContentRepositoryInterface` - Persistence abstraction
- `ContentSearchInterface` - Search engine abstraction

### Enums

[](#enums)

- `ContentStatus` - Lifecycle states with transition validation

### Exceptions

[](#exceptions)

- `ArticleNotFoundException`
- `InvalidStatusTransitionException`
- `ContentLockedException`
- `DuplicateSlugException`
- `InvalidContentException`
- `InvalidCategoryException`

Integration with Other Nexus Packages
-------------------------------------

[](#integration-with-other-nexus-packages)

- **`Nexus\Party`** - Access control via Party IDs (L3.5)
- **`Nexus\AuditLogger`** - Audit trail for all changes (optional)
- **`Nexus\Telemetry`** - Metrics tracking (optional)
- **`Nexus\Tenant`** - Multi-tenant scoping (via repository)

License
-------

[](#license)

MIT License. See [LICENSE](LICENSE) file for details.

Documentation
-------------

[](#documentation)

- [Getting Started Guide](docs/getting-started.md)
- [API Reference](docs/api-reference.md)
- [Integration Guide](docs/integration-guide.md)
- [Basic Usage Examples](docs/examples/basic-usage.php)
- [Advanced Usage Examples](docs/examples/advanced-usage.php)

Requirements
------------

[](#requirements)

- PHP 8.3+
- No external dependencies (pure PHP package)

---

**Package Status:** ✅ Production Ready
**Version:** 1.0.0
**Last Updated:** 2025-11-24

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance93

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity34

Early-stage or recently created project

 Bus Factor1

Top contributor holds 76.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

36d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/117408?v=4)[Azahari Zaman](/maintainers/azaharizaman)[@azaharizaman](https://github.com/azaharizaman)

---

Top Contributors

[![azaharizaman](https://avatars.githubusercontent.com/u/117408?v=4)](https://github.com/azaharizaman "azaharizaman (460 commits)")[![Copilot](https://avatars.githubusercontent.com/in/1143301?v=4)](https://github.com/Copilot "Copilot (139 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (2 commits)")

---

Tags

documentationcontentcmsversioningarticlesKnowledge Base

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/azaharizaman-nexus-content/health.svg)

```
[![Health](https://phpackages.com/badges/azaharizaman-nexus-content/health.svg)](https://phpackages.com/packages/azaharizaman-nexus-content)
```

###  Alternatives

[backpack/crud

Quickly build admin interfaces using Laravel, Bootstrap and JavaScript.

3.4k3.6M217](/packages/backpack-crud)[whitecube/nova-page

Static pages content management for Laravel Nova

23996.4k1](/packages/whitecube-nova-page)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
