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
============================

2656PHP

Since Jun 19Pushed 1y 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 1mo ago

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

19

—

LowBetter than 10% of packages

Maintenance27

Infrequent updates — may be unmaintained

Popularity19

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

[masterminds/html5

An HTML5 parser and serializer.

1.8k242.8M229](/packages/masterminds-html5)[sabberworm/php-css-parser

Parser for CSS Files written in PHP

1.8k191.2M65](/packages/sabberworm-php-css-parser)[jms/metadata

Class/method/property metadata management in PHP

1.8k152.8M88](/packages/jms-metadata)[jms/serializer-bundle

Allows you to easily serialize, and deserialize data of any complexity

1.8k89.3M627](/packages/jms-serializer-bundle)[hassankhan/config

Lightweight configuration file loader that supports PHP, INI, XML, JSON, and YAML files

97513.5M170](/packages/hassankhan-config)[meyfa/php-svg

Read, edit, write, and render SVG files with PHP

54613.9M42](/packages/meyfa-php-svg)

PHPackages © 2026

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