PHPackages                             fxcjahid/laravel-table-of-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. [Utility &amp; Helpers](/categories/utility)
4. /
5. fxcjahid/laravel-table-of-content

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

fxcjahid/laravel-table-of-content
=================================

Laravel Table Of Content Generator

2.2.1(3y ago)0927↓61.7%1MITPHPPHP ^7.0||^8.0

Since Feb 25Pushed 3y ago1 watchersCompare

[ Source](https://github.com/fxcjahid/Laravel-table-of-content)[ Packagist](https://packagist.org/packages/fxcjahid/laravel-table-of-content)[ RSS](/packages/fxcjahid-laravel-table-of-content/feed)WikiDiscussions main Synced yesterday

READMEChangelog (5)Dependencies (3)Versions (6)Used By (1)

Laravel Table of Content Generator
==================================

[](#laravel-table-of-content-generator)

Generates a Table of Contents from ***H1...H6*** Tags in HTML Content

This package provides a simple library to build a Table-of-Contents from HTML markup. It does so by evaluating your *H1...H6* tags. It can also automatically add appropriate *id* anchor attributes to header tags so that in-page links work.

Features:

- Generates HTML menus and [KnpMenu Item](https://github.com/KnpLabs/KnpMenu) Menus
- Add anchor ID attributes to *H1*...*H6* tags in your content where they haven't attributes
- You can specify tag which *H1*...*H6* heading tag levels to include in the TOC
- Uses the flexible [KnpMenu Library](https://github.com/KnpLabs/KnpMenu) to generate menus
- [PSR-12](https://www.php-fig.org/psr/psr-12/) compliant
- Composer-compatible
- Unit-tested (95% coverage)

Installation Options
--------------------

[](#installation-options)

Install with composer :

`composer require fxcjahid/laravel-table-of-content`

Usage
-----

[](#usage)

This package contains two main classes:

1. ` fxcjahid\LaravelTableOfContent\MarkupFixer`: Adds `id` anchor attributes to any *H1*...*H6* tags that do not already have any (you can specify which header tag levels to use at runtime)
2. `fxcjahid\LaravelTableOfContent\Table ` : Generates a Table of Contents from HTML markup

Basic Example:

```
use fxcjahid\LaravelTableOfContent\Table;
use fxcjahid\LaravelTableOfContent\MarkupFixer;

$content = getTableContent($getFixContent);

       $htmlOut  = "" . $getFixContent . "";
       $htmlOut .= "" . $getTableOfContent . "";

       echo $htmlOut;

 }
```

- This package inspired by

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 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 ~12 days

Total

5

Last Release

1175d ago

Major Versions

0.1 → 2.02023-04-10

PHP version history (3 changes)0.1PHP ^7.1

2.0PHP ^7.1||^8.1

2.1PHP ^7.0||^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/33903532?v=4)[Mohammad Jahid](/maintainers/fxcjahid)[@fxcjahid](https://github.com/fxcjahid)

---

Top Contributors

[![fxcjahid](https://avatars.githubusercontent.com/u/33903532?v=4)](https://github.com/fxcjahid "fxcjahid (16 commits)")

---

Tags

laravel-packagetable-of-contents-generatorTOCtable-of-contentsLaravel Table Of Content

### Embed Badge

![Health badge](/badges/fxcjahid-laravel-table-of-content/health.svg)

```
[![Health](https://phpackages.com/badges/fxcjahid-laravel-table-of-content/health.svg)](https://phpackages.com/packages/fxcjahid-laravel-table-of-content)
```

###  Alternatives

[caseyamcl/toc

Simple Table-of-Contents Generator for PHP. Generates TOCs based off H1...H6 tags

91368.9k5](/packages/caseyamcl-toc)[roundcube/roundcubemail

The Roundcube Webmail suite

7.1k2.4k3](/packages/roundcube-roundcubemail)[metamodels/core

MetaModels core

10156.4k67](/packages/metamodels-core)[cpsit/project-builder

Composer package to create new projects from project templates

2639.3k3](/packages/cpsit-project-builder)[voidagency/vactory_starter_kit

Vactory is a custom Drupal profile which is developed and released by VOID Agency.

1021.6k](/packages/voidagency-vactory-starter-kit)

PHPackages © 2026

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