PHPackages                             cable8mm/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. cable8mm/toc

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

cable8mm/toc
============

The TOC is an opinionated table of contents generator.

v1.3.0(10mo ago)06MITPHPPHP ^8.1CI passing

Since Apr 26Pushed 10mo ago1 watchersCompare

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

READMEChangelog (6)Dependencies (2)Versions (7)Used By (0)

TOC - TOC library for document2
===============================

[](#toc---toc-library-for-document2)

[![code-style](https://github.com/cable8mm/toc/actions/workflows/code-style.yml/badge.svg)](https://github.com/cable8mm/toc/actions/workflows/code-style.yml)[![run-tests](https://github.com/cable8mm/toc/actions/workflows/run-tests.yml/badge.svg)](https://github.com/cable8mm/toc/actions/workflows/run-tests.yml)[![Packagist Version](https://camo.githubusercontent.com/f8a7f9e1fe622e43c96d139a3d45e752fce4a17de3ea7c2d88b86fe59466958d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6361626c65386d6d2f746f63)](https://packagist.org/packages/cable8mm/toc)[![Packagist Downloads](https://camo.githubusercontent.com/0b687b7b3bad56394c9e71531ac43cc54dfc85fd7c00dc44c72bb6003dac8b95/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6361626c65386d6d2f746f63)](https://packagist.org/packages/cable8mm/toc/stats)[![Packagist Dependency Version](https://camo.githubusercontent.com/f2c689322c81b562ba6f598b90dc480521d2ea2c3f86992ff86d4056207a2efc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f6361626c65386d6d2f746f632f706870)](https://packagist.org/packages/cable8mm/toc)[![Packagist Stars](https://camo.githubusercontent.com/51d81e374d3b48cd9abf94d4a69735d62d5a78bb5eb97fc5082608a3928f55bd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f73746172732f6361626c65386d6d2f746f63)](https://github.com/cable8mm/toc/stargazers)[![Packagist License](https://camo.githubusercontent.com/6fb75475c387dc8c3ec3c7dcbfb43a092219891a5de7e20a9a8414ef65a8e43c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6361626c65386d6d2f746f63)](https://github.com/cable8mm/toc/blob/main/LICENSE.md)

The TOC is a library for the project [document2](https://github.com/cable8mm/document2).

Features
--------

[](#features)

- Laravel toc
- Samsung Tizen toc
- Naver clova ai toc
- Rhymix toc

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

[](#installation)

```
composer require cable8mm/toc
```

Usage
-----

[](#usage)

```
namespace Cable8mm\Toc;

$markdown = '
- ## Prologue
    - [Release Notes](/docs/{{version}}/releases)
    - [Upgrade Guide](/docs/{{version}}/upgrade)
    - [Contribution Guide](/docs/{{version}}/contributions)
- ## Getting Started
    - [Installation](/docs/{{version}}/installation)
    - [Configuration](/docs/{{version}}/configuration)
';

$lines = Toc::of($markdown)->getLines();

foreach ($lines as $line) {
    // example "- ## Prologue"
    // example "    - [Release Notes](/docs/{{version}}/releases)"
    print $line->getTitle().PHP_EOL;
    //=> "Prologue"
    //=> "Release Notes"
    print $line->getLink().PHP_EOL;
    //=> null
    //=> "/docs/{{version}}/releases"
    print $line->getType().PHP_EOL;
    //=> ItemEnum::section
    //=> ItemEnum::page
    print $line->getDepth().PHP_EOL;
    //=> 1
    //=> 2
}
```

Testing
-------

[](#testing)

```
composer test
```

Formatting
----------

[](#formatting)

```
composer lint
# Modify all files to comply with the PSR-12.

composer inspect
# Inspect all files to ensure compliance with PSR-12.
```

License
-------

[](#license)

The Document2 project is open-sourced software licensed under the [MIT license](LICENSE).

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance55

Moderate activity, may be stable

Popularity4

Limited adoption so far

Community7

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

Recently: every ~112 days

Total

6

Last Release

301d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c910c874a0263a18f9f976273054cd45faa3ffbcba7891992f4ab52d0656dd93?d=identicon)[Sam Lee](/maintainers/Sam%20Lee)

---

Top Contributors

[![cable8mm](https://avatars.githubusercontent.com/u/2672043?v=4)](https://github.com/cable8mm "cable8mm (13 commits)")

---

Tags

document2

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/cable8mm-toc/health.svg)

```
[![Health](https://phpackages.com/badges/cable8mm-toc/health.svg)](https://phpackages.com/packages/cable8mm-toc)
```

PHPackages © 2026

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