PHPackages                             prashant-malla/laravel-auto-toc - 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. prashant-malla/laravel-auto-toc

ActiveLibrary

prashant-malla/laravel-auto-toc
===============================

Automatically generate a Table of Contents from rich text editor HTML content in Laravel.

v1.0.0(2mo ago)311MITPHPPHP ^8.1

Since Feb 28Pushed 2mo agoCompare

[ Source](https://github.com/prashant-malla/laravel-auto-toc)[ Packagist](https://packagist.org/packages/prashant-malla/laravel-auto-toc)[ RSS](/packages/prashant-malla-laravel-auto-toc/feed)WikiDiscussions main Synced 1mo ago

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

Laravel Auto TOC
================

[](#laravel-auto-toc)

Automatically generate a Table of Contents (TOC) from rich text editor HTML content in Laravel.

The package parses HTML headings (h2–h6 by default), injects unique `id` attributes, and stores a structured TOC via a polymorphic relationship — perfect for blogs, tours, documentation, and any CKEditor / TinyMCE / Trix content.

---

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

[](#installation)

```
composer require prashant-malla/laravel-auto-toc
```

The service provider is auto-discovered. If you need to register it manually:

```
// config/app.php → providers
PrashantMalla\AutoToc\AutoTocServiceProvider::class,
```

### Publish &amp; run migrations

[](#publish--run-migrations)

```
php artisan vendor:publish --tag=auto-toc-migrations
php artisan migrate
```

### Publish config (optional)

[](#publish-config-optional)

```
php artisan vendor:publish --tag=auto-toc-config
```

---

Usage
-----

[](#usage)

### 1. Use the trait on any Eloquent model

[](#1-use-the-trait-on-any-eloquent-model)

```
