PHPackages                             farsi/inertia-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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. farsi/inertia-content

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

farsi/inertia-content
=====================

Nuxt Content-compatible content engine for Laravel + Inertia

v1.0.0-rc.6(5mo ago)021MITPHPPHP ^8.1CI passing

Since Dec 29Pushed 5mo agoCompare

[ Source](https://github.com/farsidev/inertia-content)[ Packagist](https://packagist.org/packages/farsi/inertia-content)[ Docs](https://github.com/farsidev/inertia-content)[ RSS](/packages/farsi-inertia-content/feed)WikiDiscussions develop Synced 3w ago

READMEChangelogDependencies (5)Versions (14)Used By (0)

Inertia Content
===============

[](#inertia-content)

[![Latest Version on Packagist](https://camo.githubusercontent.com/aa4ecd46d48747f501bd396933b1156a2ac88aa062ceb37eb86bced5e010dc6c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f66617273692f696e65727469612d636f6e74656e742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/farsi/inertia-content)[![GitHub Tests Status](https://camo.githubusercontent.com/33bdd49659d18dedf5d6098782838a42cdca7a424cd5c07768f281de73705bad/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f66617273696465762f696e65727469612d636f6e74656e742f74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/farsidev/inertia-content/actions/workflows/tests.yml)[![Code Coverage](https://camo.githubusercontent.com/8ed38cc7fb3373d5dd194faa5b01bff3c19f998edf5cfd0a344681e9b3750737/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f66617273696465762f696e65727469612d636f6e74656e743f7374796c653d666c61742d737175617265)](https://codecov.io/gh/farsidev/inertia-content)[![Total Downloads](https://camo.githubusercontent.com/860deb0d67fe1cd402a266912ced7a91cc9425baaedf111b4227d1eff8414c54/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f66617273692f696e65727469612d636f6e74656e742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/farsi/inertia-content)[![License](https://camo.githubusercontent.com/82d8ea77607b8e66a46f106185dfc4b56faa7972c900de736b2688de6384c56e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f66617273692f696e65727469612d636f6e74656e743f7374796c653d666c61742d737175617265)](https://packagist.org/packages/farsi/inertia-content)

A **Nuxt Content-compatible** content management system for Laravel + Inertia.js + Vue applications. Write Markdown, get Vue components, query with Laravel – all with build-time compilation and zero runtime overhead.

**Latest Version**: `v1.0.0` (Stable)

Why Inertia Content?
--------------------

[](#why-inertia-content)

Traditional CMS solutions force you to pass HTML through Inertia props or parse Markdown at runtime. Inertia Content takes a different approach: **compile Markdown to Vue components at build time**, while Laravel maintains full control over routing and access.

### Key Benefits

[](#key-benefits)

- 📝 **File-based content** - Write Markdown files, get compiled Vue components
- ⚡ **Build-time compilation** - Zero runtime parsing, optimal performance
- 🔍 **Powerful queries** - Nuxt Content-style query API in PHP
- 🎯 **Full TypeScript support** - Type safety from PHP to Vue
- 🔥 **Hot Module Replacement** - Instant updates during development
- 🎨 **Familiar API** - If you know Nuxt Content, you already know this
- 🔐 **Laravel-first** - Server-side access control and routing
- 🚀 **Production-ready** - Caching, optimization, and security built-in

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

[](#installation)

Inertia Content is a **single Composer package** that includes both PHP and JavaScript code.

```
# 1. Install via Composer
composer require farsi/inertia-content

# 2. Install JavaScript dependencies (IMPORTANT!)
cd vendor/farsi/inertia-content && npm install && cd -

# 3. Run installer
php artisan inertia-content:install
```

The JavaScript/Vue components are TypeScript source files that **your Vite will compile** - no pre-built JavaScript.

📖 See [How It Works](./docs/how-it-works.md) for detailed explanation.

Setup
-----

[](#setup)

### 1. Add Vite Plugin

[](#1-add-vite-plugin)

Add the Vite plugin to your `vite.config.ts`:

```
import { defineConfig } from 'vite'
import laravel from 'laravel-vite-plugin'
import vue from '@vitejs/plugin-vue'
import inertiaContent from './vendor/farsi/inertia-content/resources/js/vite'

export default defineConfig({
  plugins: [
    laravel({
      input: ['resources/js/app.ts'],
      refresh: true,
    }),
    vue(),
    inertiaContent(),
  ],
  resolve: {
    alias: {
      '@inertia-content': '/vendor/farsi/inertia-content/resources/js'
    }
  }
})
```

### 2. Create Content

[](#2-create-content)

Create markdown files in `resources/content`:

```
---
title: Getting Started
description: Learn how to use Inertia Content
order: 1
---

## Introduction

Welcome to **Inertia Content**!
```

### 3. Add Routes

[](#3-add-routes)

Add content routes to `routes/web.php`:

```
use Farsi\InertiaContent\Facades\Content;

Route::get('/docs/{path?}', function ($path = 'index') {
    return Content::pageOrFail("docs/$path");
})->where('path', '.*');
```

### 4. Render Content

[](#4-render-content)

Create a Vue component to render content:

```

import { ContentDoc } from '@inertia-content'
import { usePage } from '@inertiajs/vue3'

const page = usePage()

```

Usage
-----

[](#usage)

### Query Content (PHP)

[](#query-content-php)

```
use Farsi\InertiaContent\Facades\Content;

// Find a single entry
$entry = Content::find('docs/intro');

// Check if content exists
if (Content::exists('docs/intro')) {
    // ...
}

// Query multiple entries
$entries = Content::query()
    ->where('_dir', 'docs')
    ->where('draft', false)
    ->orderBy('order', 'asc')
    ->get();

// Get navigation tree
$nav = Content::navigation('docs');
```

### Render Content (Vue)

[](#render-content-vue)

#### ContentRenderer Component

[](#contentrenderer-component)

Simple content rendering:

```

import { ContentRenderer } from 'farsi-inertia-content'

```

#### ContentDoc Component

[](#contentdoc-component)

Full document with header, TOC, and footer:

```

import { ContentDoc } from 'farsi-inertia-content'

      {{ meta.title }}
      {{ meta.description }}

          {{ h.text }}

```

#### ContentList Component

[](#contentlist-component)

List multiple content entries:

```

import { ContentList } from 'farsi-inertia-content'
import { Link } from '@inertiajs/vue3'

          {{ entry.title }}
          {{ entry._excerpt }}

```

#### useContent Composable

[](#usecontent-composable)

For advanced use cases:

```

import { useContent } from 'farsi-inertia-content'

const { component, meta, headings, isLoading, error } = useContent('docs/intro')

  Loading...
  Error: {{ error.message }}

    {{ meta.title }}

```

Frontmatter
-----------

[](#frontmatter)

Supported frontmatter fields:

```
---
title: Page Title              # Required
description: Page description  # Optional
draft: false                   # Optional, default: false
navigation: true               # Optional, default: true
order: 1                       # Optional, for sorting
excerpt: Custom excerpt        # Optional, auto-generated if not provided
# ... any custom fields
---
```

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

[](#configuration)

Publish the configuration file:

```
php artisan vendor:publish --tag=inertia-content-config
```

Available options in `config/inertia-content.php`:

```
return [
    'content_dir' => resource_path('content'),
    'manifest_path' => public_path('build/inertia-content-manifest.json'),
    'show_drafts' => env('INERTIA_CONTENT_SHOW_DRAFTS', false),
    'default_component' => 'Content/Page',
    // ... more options
];
```

Commands
--------

[](#commands)

```
# Install the package
php artisan inertia-content:install

# Clear content cache
php artisan inertia-content:clear
```

Testing
-------

[](#testing)

```
# PHP tests
composer test

# JavaScript tests
npm test
```

How It Works
------------

[](#how-it-works)

Inertia Content follows a unique architecture that respects both Laravel and Inertia.js philosophies:

### Build Time

[](#build-time)

1. Vite plugin scans `resources/content/**/*.md`
2. Parses frontmatter, extracts headings, generates excerpts
3. Compiles Markdown → Vue components
4. Generates JSON manifest with metadata

### Runtime

[](#runtime)

1. Laravel queries the manifest (cached)
2. Passes only the content **key** through Inertia (never HTML/Markdown)
3. Vue dynamically imports the pre-compiled component
4. Component renders instantly (already compiled)

### Key Innovation

[](#key-innovation)

**No HTML through Inertia props. No runtime Markdown parsing.**

Laravel maintains authority over:

- ✅ Content queries and filtering
- ✅ Access control and permissions
- ✅ Routing decisions

Vue handles:

- ✅ Component rendering (pre-compiled)
- ✅ User interactions
- ✅ Client-side navigation

Comparison
----------

[](#comparison)

FeatureInertia ContentTraditional CMSStatic Site Generators**Runtime Parsing**❌ No✅ Yes❌ No**Build Performance**⚡ FastN/A⚡ Fast**Laravel Integration**✅ Native⚠️ API-based❌ Separate**Dynamic Queries**✅ Yes✅ Yes❌ Limited**Type Safety**✅ Full⚠️ Partial⚠️ Partial**HMR**✅ Yes⚠️ Sometimes✅ Yes**Server Authority**✅ Complete✅ Complete❌ No serverNuxt Content Compatibility
--------------------------

[](#nuxt-content-compatibility)

This package implements **80% of Nuxt Content v2 core features**, adapted for Laravel + Inertia:

✅ **Implemented:**

- Query API (`Content::query()` ≈ `queryContent()`)
- Markdown parsing with frontmatter
- Heading extraction &amp; TOC
- Navigation generation
- HMR support
- Vue components
- TypeScript support

⏳ **Planned for v1.1:**

- MDC (Markdown Components)
- Full-text search
- Syntax highlighting (Shiki)
- YAML/JSON file support

See [Nuxt Content Comparison](./docs/nuxt-content-comparison.md) for detailed feature parity analysis.

Roadmap
-------

[](#roadmap)

- Markdown compilation
- Query API (Nuxt Content-compatible)
- Vue components
- HMR support
- TypeScript support
- MDC (Markdown Components) - v1.1
- Full-text search - v1.1
- Shiki syntax highlighting - v1.1
- YAML/JSON support - v1.1
- Content versioning - v1.2
- Multi-language support - v1.2

Contributing
------------

[](#contributing)

Contributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details.

Security
--------

[](#security)

If you discover any security-related issues, please email  instead of using the issue tracker.

See [Security Policy](./docs/security.md) for more details.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

Credits
-------

[](#credits)

- [Farsi Dev](https://github.com/farsidev)
- Inspired by [Nuxt Content](https://content.nuxtjs.org/)
- Built with [Spatie's Laravel Package Skeleton](https://github.com/spatie/package-skeleton-laravel)
- All contributors

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

[](#package-architecture)

This is a **single Composer package** that includes both PHP and JavaScript code.

📦 **Installation**: `composer require farsi/inertia-content`📂 **JavaScript**: Included in `vendor/farsi/inertia-content/resources/js/`🔌 **Vite Plugin**: Import from vendor directory

See [Package Structure](./docs/structure.md) and [Architecture](./docs/architecture.md) for details.

Support
-------

[](#support)

- ⭐ Star the repo
- 🐛 Report bugs via [GitHub Issues](https://github.com/farsidev/inertia-content/issues)
- 💬 Discuss features via [GitHub Discussions](https://github.com/farsidev/inertia-content/discussions)
- 📖 Read the [full documentation](./docs/README.md)

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance70

Regular maintenance activity

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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

Every ~0 days

Total

10

Last Release

176d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/90d288522bd317ce5f88a1f746d39bfcfebae03de58b9e8c9881dc776cf8e9f2?d=identicon)[farsi](/maintainers/farsi)

---

Top Contributors

[![aliwesome](https://avatars.githubusercontent.com/u/21131502?v=4)](https://github.com/aliwesome "aliwesome (28 commits)")

---

Tags

laravelmarkdowncontentinertianuxt-content

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/farsi-inertia-content/health.svg)

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

###  Alternatives

[erag/laravel-lang-sync-inertia

A powerful Laravel package for syncing and managing language translations across backend and Inertia.js (Vue/React) frontends, offering effortless localization, auto-sync features, and smooth multi-language support for modern Laravel applications.

4821.5k](/packages/erag-laravel-lang-sync-inertia)[emargareten/inertia-modal

Inertia Modal is a Laravel package that lets you implement backend-driven modal dialogs for Inertia apps.

90128.1k](/packages/emargareten-inertia-modal)[cartalyst/interpret

A driver-based content rendering package, with support for HTML, Markdown &amp; plain text. You can register custom drivers for custom content types.

1916.4k](/packages/cartalyst-interpret)[grazulex/laravel-atlas

Laravel Atlas scans your Laravel project to generate a complete, structured map of its internal components — models, controllers, routes, jobs, observers, events, commands, and more — and exports visual or machine-readable representations in formats like Mermaid, Markdown, JSON, or PDF.

192.3k](/packages/grazulex-laravel-atlas)

PHPackages © 2026

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