PHPackages                             ashtaev/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. ashtaev/toc

ActiveLibrary

ashtaev/toc
===========

Простой PHP скрипт для создания содержания статьи на основе заголовков.

v1.0.1(7y ago)53801MITPHP

Since Mar 15Pushed 7y agoCompare

[ Source](https://github.com/ashtaev/php-table-of-contents)[ Packagist](https://packagist.org/packages/ashtaev/toc)[ Docs](http://github.com/ashtaev/toc)[ RSS](/packages/ashtaev-toc/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependenciesVersions (3)Used By (0)

PHP Table of Contents
=====================

[](#php-table-of-contents)

[![Latest Stable Version](https://camo.githubusercontent.com/a69012084f1d900e5d219688359d6558fd85c4f28b3bb5559f0c67a2c4f3174c/68747470733a2f2f706f7365722e707567782e6f72672f617368746165762f746f632f762f737461626c65)](https://packagist.org/packages/ashtaev/toc)[![Total Downloads](https://camo.githubusercontent.com/cfed116489f5e1b379a2e766e8c74670da2506e6fad5cff909af7c974983a429/68747470733a2f2f706f7365722e707567782e6f72672f617368746165762f746f632f646f776e6c6f616473)](https://packagist.org/packages/ashtaev/toc)[![Latest Unstable Version](https://camo.githubusercontent.com/f9a3d3b98b64784c258131c64ac5ac04f00e5c8d131ec14eed381b7a5655a89c/68747470733a2f2f706f7365722e707567782e6f72672f617368746165762f746f632f762f756e737461626c65)](https://packagist.org/packages/ashtaev/toc)[![License](https://camo.githubusercontent.com/72bfcd92849ec9e4a6edf9f2897f8b7e0d6bc58ce5bf577f87bcf83c85555c00/68747470733a2f2f706f7365722e707567782e6f72672f617368746165762f746f632f6c6963656e7365)](https://packagist.org/packages/ashtaev/toc)

A lightweight PHP library, for generating table of contents in the style of Wikipedia. It automatically generates table of contents for your posts, pages and custom post types by parsing its contents for headers. By doing so, you can let your readers jump to a corresponding header by clicking on a link in the TOC. You can place this TOC anywhere in a post using the shortcodes. You don’t have to add any links or create any anchors for this. Built Wikipedia in mind, the table of contents by default appears before the first heading on a page. You also get various methods to configure your TOC and control how it is going to appear. Also, it sets no limit to the number of TOC you can create. You can go on and have as many TOC as you want.

Screenshots
-----------

[](#screenshots)

They're rendered using the sample templates provided in the [templates](templates/) directory, which depend on Bootstrap 4. You can easily use your own custom HTML to render the table of contents instead.

Default template:

[![](screenshot-toc.png)](screenshot-toc.png)

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

[](#installation)

Install with composer:

```
composer require ashtaev/toc

```

Basic usage
-----------

[](#basic-usage)

Here's a quick example using the defaults:

```

    Lorem ipsum

```

This will output the following:

```
Lorem ipsum...

    Content

        Lorem ipsum
        Expedita sint
        Maiores quas

                Delectus laudantium
                Eaque quisquam?
                Deleniti et

                        Facilis iusto!
                        Beatae eveniet

                Beatae fugit?

        Fugit in maxime
        Odit reprehenderit

"1. Lorem ipsum

Lorem ipsum dolor...

```

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity61

Established project with proven stability

 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

2

Last Release

2618d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2e3419af78553572971db1dbdd20da7be94e25553770b54d4e5b64618a83976d?d=identicon)[ashtaev](/maintainers/ashtaev)

---

Top Contributors

[![ashtaev](https://avatars.githubusercontent.com/u/28447343?v=4)](https://github.com/ashtaev "ashtaev (8 commits)")

---

Tags

contentsphptable-of-contentstocTOCtable-of-contents

### Embed Badge

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

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

###  Alternatives

[caseyamcl/toc

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

92344.9k5](/packages/caseyamcl-toc)[cooltronicpl/document-helpers

Revolutionize your PDF creation process with the PDF Generator for Craft CMS. Create and manage PDFs with ease using customizable templates and a range of options.

144.8k](/packages/cooltronicpl-document-helpers)

PHPackages © 2026

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