PHPackages                             freshleafmedia/tiptap-parser - 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. freshleafmedia/tiptap-parser

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

freshleafmedia/tiptap-parser
============================

2742PHP

Since Jun 19Pushed 2y ago1 watchersCompare

[ Source](https://github.com/freshleafmedia/tiptap-parser)[ Packagist](https://packagist.org/packages/freshleafmedia/tiptap-parser)[ RSS](/packages/freshleafmedia-tiptap-parser/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

Tiptap JSON Parser
==================

[](#tiptap-json-parser)

[![Latest Version on Packagist](https://camo.githubusercontent.com/e426a79b2c183fa41d3424f04e4d83a3252ccb3bdd906e3513fd4dee56f19ea8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f66726573686c6561666d656469612f7469707461702d7061727365722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/freshleafmedia/tiptap-parser)[![Total Downloads](https://camo.githubusercontent.com/939fa30d8e0ea58f84c423254ddc9afc50264cca3bbaf4f61d7da0e35047db48/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f66726573686c6561666d656469612f7469707461702d7061727365722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/freshleafmedia/tiptap-parser)[![License](https://camo.githubusercontent.com/395135ca190421b3b99d88a38e742d7f59e5ecb05a8828615c97d37911cd694c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f66726573686c6561666d656469612f7469707461702d7061727365723f7374796c653d666c61742d737175617265)](https://packagist.org/packages/freshleafmedia/tiptap-parser)

---

This package simply converts the JSON output from the [Tiptap editor](https://github.com/awcodes/filament-tiptap-editor) to HTML. It differs from [other packages](https://github.com/ueberdosis/tiptap-php) by allowing you to easily customise and extend the HTML output.

---

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

[](#installation)

```
composer require freshleafmedia/tiptap-parser

```

Basic Usage
-----------

[](#basic-usage)

```
use FreshleafMedia\TiptapParser\TiptapContent;

$tiptapArray = [
    'type' => 'paragraph',
    'content' => [
        [
            'type' => 'text',
            'text' => 'Hello world',
        ],
    ],
];

TiptapContent::make($tiptapArray)->toHtml(); // Hello world
```

Customising A Node
------------------

[](#customising-a-node)

```
use FreshleafMedia\TiptapParser\Nodes\Paragraph;

readonly class CustomParagraph extends Paragraph
{
    public function render(): string
    {
        return toHtml(); // Hello world
```

Accessing Custom Attributes
---------------------------

[](#accessing-custom-attributes)

Nodes are instantiated via the `fromArray` method, the method is passed all the data from the original array.

For example given this array:

```
[
    'type' => 'paragraph',
    'attrs' => [
        'lang' => 'en',
    ]
]
```

We can easily add the `lang` attribute to the `p` element like this:

```
use FreshleafMedia\TiptapParser\Nodes\Paragraph;

readonly class LocalisedParagraph extends Paragraph
{
    public function __construct(
        public string $language,
        public array $children = [],
    )
    {
    }

    public function render(): string
    {
        return
                {$this->renderInnerHtml()}

            HTML;
    }

    public static function fromArray(array $array): self
    {
        return new self(
            $array['attrs']['lang'] ?? 'en',
            $array['children'] ?? [],
        );
    }
}
```

Plain Text
----------

[](#plain-text)

Plain text can be extracted available via the `toText` method. This is useful for things like populating a search index.

```
use FreshleafMedia\TiptapParser\TiptapContent;

$tiptapArray = [
    'type' => 'paragraph',
    'content' => [
        [
            'type' => 'text',
            'text' => 'Hello world',
            'marks' => [
                ['type' => 'bold'],
            ],
        ],
    ],
];

TiptapContent::make($tiptapArray)->toHtml(); // Hello world
TiptapContent::make($tiptapArray)->toText(); // Hello world
```

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity18

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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/10062339?v=4)[Freshleaf Media](/maintainers/freshleafmedia)[@freshleafmedia](https://github.com/freshleafmedia)

---

Top Contributors

[![freshleafmedia](https://avatars.githubusercontent.com/u/10062339?v=4)](https://github.com/freshleafmedia "freshleafmedia (30 commits)")

---

Tags

hacktoberfestparserrendertiptaptiptap-editor

### Embed Badge

![Health badge](/badges/freshleafmedia-tiptap-parser/health.svg)

```
[![Health](https://phpackages.com/badges/freshleafmedia-tiptap-parser/health.svg)](https://phpackages.com/packages/freshleafmedia-tiptap-parser)
```

###  Alternatives

[mck89/peast

Peast is PHP library that generates AST for JavaScript code

19139.2M47](/packages/mck89-peast)[sauladam/shipment-tracker

Parses tracking information for several carriers, like UPS, USPS, DHL and GLS by simply scraping the data. No need for any kind of API access.

9843.5k](/packages/sauladam-shipment-tracker)[jstewmc/rtf

Read and write Rich Text Format (RTF) documents with PHP

45153.1k6](/packages/jstewmc-rtf)[tcds-io/php-jackson

A lightweight, flexible object serializer for PHP, inspired by FasterXML/jackson

113.2k10](/packages/tcds-io-php-jackson)

PHPackages © 2026

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