PHPackages                             broqit/editorjs-simple-html-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. broqit/editorjs-simple-html-parser

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

broqit/editorjs-simple-html-parser
==================================

A simple Json to Html parser for EditorJS library

0.1.3(1y ago)0151MITPHPPHP &gt;=8.1

Since Aug 22Pushed 1y agoCompare

[ Source](https://github.com/broqit/editorjs-simple-html-parser)[ Packagist](https://packagist.org/packages/broqit/editorjs-simple-html-parser)[ RSS](/packages/broqit-editorjs-simple-html-parser/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (9)Dependencies (1)Versions (10)Used By (0)

[![codecov](https://camo.githubusercontent.com/6bf5518c3ef94b272a0c8dd7ca3d0cb377c4b92e4db0a70d3d29fcd04b8f00a3/68747470733a2f2f636f6465636f762e696f2f67682f4475726c65636f64652f656469746f726a732d73696d706c652d68746d6c2d7061727365722f6272616e63682f6d61737465722f67726170682f62616467652e7376673f746f6b656e3d4f4b4735344558394333)](https://codecov.io/gh/Durlecode/editorjs-simple-html-parser)[![License: GPL v3](https://camo.githubusercontent.com/48bf9b56d44f38db53ce21294cf0b9487d0a3734ab3ba1fe4c69858ae20db2c1/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d47504c76332d626c75652e737667)](https://www.gnu.org/licenses/gpl-3.0)

Simple PHP Parser for Editor.js
===============================

[](#simple-php-parser-for-editorjs)

Parse data for [Editor.js](https://editorjs.io/ "Editor.js Homepage") with 2 way:

1. Parse JSON data to HTML
2. Parse HTML to JSON data

Supported Tools
---------------

[](#supported-tools)

PackageKeyMain CSS Class
(with default prefix)Additional / modificator CSS classes
(with default prefix)`@editorjs/header`
`editorjs-header-with-alignment``header``.prs-header`alignment:
`.prs_left`
`.prs_right`
`.prs_center`
`.prs_justify``@editorjs/paragraph`
`editorjs-paragraph-with-alignment``paragraph``.prs-paragraph`alignment:
`.prs_left`
`.prs_right`
`.prs_center`
`.prs_justify``@editorjs/inline-code``@editorjs/marker``@editorjs/underline``@editorjs/list``list``.prs-list`additional:
`.prs_ordered``@editorjs/raw``raw``@editorjs/simple-image``simpleImage``.prs-image`additional:
`.prs_withborder`
`.prs_withbackground`
`.prs_stretched``@editorjs/embed``embed``.prs-embed`additional:
`.prs_youtube`
`.prs_codepen`
`.prs_vimeo``@editorjs/link``linkTool``.prs-linktool`additional:
`.prs_title`
`.prs_description`
`.prs_sitename``@editorjs/delimiter``delimiter``.prs-delimiter``editorjs-alert``alert``.prs-alert`alignment:
`.prs_left`
`.prs_right`
`.prs_center`
additional:
`.prs_primary`
`.prs_secondary`
`.prs_info`
`.prs_success`
`.prs_warning`
`.prs_danger`
`.prs_light`
`.prs_dark``@editorjs/warning``warning``.prs-warning``@editorjs/table``table``.prs-table`additional:
`.prs_withheadings``@editorjs/quote``quote``.prs-quote`alignment:
`.prs_left`
`.prs_center``@editorjs/code``code``.prs-code`Installation
------------

[](#installation)

```
composer require broqit/editorjs-simple-html-parser

```

1. JSON to HTML Parser
----------------------

[](#1-json-to-html-parser)

### Usage

[](#usage)

```
use Durlecode\EJSParser\Parser;

$html = Parser::parse($data)->toHtml();
```

Where `$data` is the clean JSON data coming from Editor.js *See `$data` example below*

```
{
    "time" : 1583848289745,
    "blocks" : [
        {
            "type" : "header",
            "data" : {
                "text" : "Hello World",
                "level" : 2
            }
        }
    ],
    "version" : "2.16.1"
}
```

By default this will generate html with css classes with `prs` prefix, so if you want to change it, follow example below

```
use Durlecode\EJSParser\Parser;

$parser = new Parser($data);

$parser->setPrefix("cat");

$parsed = $parser->toHtml();
```

### Methods

[](#methods)

#### `toHtml()`

[](#tohtml)

Return generated HTML

#### `setPrefix(string $prefix)`

[](#setprefixstring-prefix)

Set CSS classes Prefix

#### `getPrefix()`

[](#getprefix)

Return current prefix

#### `getVersion()`

[](#getversion)

Return Editor.js content version

#### `getTime()`

[](#gettime)

Return Editor.js content timestamp

#### `getBlocks()`

[](#getblocks)

Return Editor.js content blocks

### Generated HTML

[](#generated-html)

##### Header

[](#header)

```
Lorem
```

##### Paragraph

[](#paragraph)

```

    Pellentesque
    malesuada fames
    tempus

```

##### Ordered List

[](#ordered-list)

```

```

##### Unordered List

[](#unordered-list)

```

```

##### Table

[](#table)

```

            12

            ab

```

##### Code

[](#code)

```

```

##### Embed

[](#embed)

###### *(Actually working with Youtube, Codepen &amp; Gfycat)*

[](#actually-working-with-youtube-codepen--gfycat)

```

    Shrek (2001) Trailer

```

##### Delimiter

[](#delimiter)

```

```

##### LinkTool

[](#linktool)

```

       Title
       Description
       example.com

```

##### Image

[](#image)

```

```

##### Quote

[](#quote)

```

```

##### Warning

[](#warning)

```

    Title
    Message

```

##### Alert

[](#alert)

```

    Alert!

```

##### Raw

[](#raw)

```

    Raw HTML ...

```

2. HTML to JSON Parser
----------------------

[](#2-html-to-json-parser)

### Usage

[](#usage-1)

```
use Durlecode\EJSParser\HtmlParser;

$parser = new HtmlParser($html);

$blocks = $parser->toBlocks();

header("Content-Type: application/json");
echo $blocks;
```

Where `$html` is the HTML specially tagged with CSS classes *See examples of the generated HTML code above*

By default this will parse html with css classes with `prs` prefix, so if you want to change it, follow example below

```
use Durlecode\EJSParser\HtmlParser;

$parser = new HtmlParser($html);

$parser->setPrefix("cat");

$blocks = $parser->toBlocks();
```

You may set time and version EditorJS generated blocks *By default: time generate auto, EditorJS version pass from config.php*:

```
use Durlecode\EJSParser\HtmlParser;

$parser = new HtmlParser($html);

$parser->setTime("1703787424242");
$parser->setVersion("2.28.8");

$blocks = $parser->toBlocks();
```

### Methods

[](#methods-1)

#### `toBlocks()`

[](#toblocks)

Return generated EditorJS Blocks

#### `setPrefix(string $prefix)`

[](#setprefixstring-prefix-1)

Set CSS classes Prefix

#### `getPrefix()`

[](#getprefix-1)

Return current prefix

#### `setVersion(string $version)`

[](#setversionstring-version)

Set Editor.js content version

#### `getVersion()`

[](#getversion-1)

Return Editor.js content version

#### `getTime()`

[](#gettime-1)

Return Editor.js content timestamp

#### `setTime(string $time)`

[](#settimestring-time)

Set Editor.js content timestamp

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance34

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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

Total

9

Last Release

624d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8b0183fae593d83cd5fb3426199ba05ec2d2513b0eb40187e4793a9145256e9d?d=identicon)[broqit](/maintainers/broqit)

---

Top Contributors

[![broqit](https://avatars.githubusercontent.com/u/27624002?v=4)](https://github.com/broqit "broqit (25 commits)")[![Edd-G](https://avatars.githubusercontent.com/u/5066751?v=4)](https://github.com/Edd-G "Edd-G (13 commits)")[![meCodeBot](https://avatars.githubusercontent.com/u/36118013?v=4)](https://github.com/meCodeBot "meCodeBot (11 commits)")[![smosmochatton](https://avatars.githubusercontent.com/u/22613134?v=4)](https://github.com/smosmochatton "smosmochatton (6 commits)")[![Durlecode](https://avatars.githubusercontent.com/u/34769127?v=4)](https://github.com/Durlecode "Durlecode (3 commits)")[![gitoido](https://avatars.githubusercontent.com/u/2114164?v=4)](https://github.com/gitoido "gitoido (2 commits)")[![hailam](https://avatars.githubusercontent.com/u/1132869?v=4)](https://github.com/hailam "hailam (1 commits)")

### Embed Badge

![Health badge](/badges/broqit-editorjs-simple-html-parser/health.svg)

```
[![Health](https://phpackages.com/badges/broqit-editorjs-simple-html-parser/health.svg)](https://phpackages.com/packages/broqit-editorjs-simple-html-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)[querypath/querypath

HTML/XML querying and processing (like jQuery)

8197.0M27](/packages/querypath-querypath)[mck89/peast

Peast is PHP library that generates AST for JavaScript code

18934.7M29](/packages/mck89-peast)

PHPackages © 2026

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