PHPackages                             mica-project/editorjs-extendable-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. mica-project/editorjs-extendable-parser

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

mica-project/editorjs-extendable-parser
=======================================

An extendable server-side bidirectional parser for EditorJS structures

1.0(1y ago)0653MITPHPPHP ^8.3

Since Jan 20Pushed 1y agoCompare

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

READMEChangelog (1)Dependencies (2)Versions (2)Used By (0)

[![codecov](https://camo.githubusercontent.com/70ba92cd24c2f66828b9215a29b46ef92761887fdf04447ec7a68966d9adc99f/68747470733a2f2f636f6465636f762e696f2f67682f6d6963612d70726f6a6563742f656469746f726a732d657874656e6461626c652d7061727365722f67726170682f62616467652e7376673f746f6b656e3d574d43464f454d335053)](https://codecov.io/gh/mica-project/editorjs-extendable-parser)[![License: MIT](https://camo.githubusercontent.com/08cef40a9105b6526ca22088bc514fbfdbc9aac1ddbf8d4e6c750e3a88a44dca/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d626c75652e737667)](https://opensource.org/license/mit)

Extendable PHP Parser for Editor.js
===================================

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

Project is heavily based on [Edd-G/editorjs-simple-html-parser](https://github.com/Edd-G/editorjs-simple-html-parser)and [Durlecode/editorjs-simple-html-parser](https://github.com/Durlecode/editorjs-simple-html-parser) work. Kudos to these guys!

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``link``.prs-link`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 mica-project/editorjs-extendable-parser

```

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

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

### Usage

[](#usage)

```
use MicaProject\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 MicaProject\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)

```

```

##### Link

[](#link)

```

       Title
       Description
       example.com

```

##### Image

[](#image)

```

##### SimpleImage

```html

```

##### 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 MicaProject\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 MicaProject\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 MicaProject\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

34

—

LowBetter than 77% of packages

Maintenance42

Moderate activity, may be stable

Popularity18

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity53

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

Unknown

Total

1

Last Release

483d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2114164?v=4)[Gitoido](/maintainers/gitoido)[@gitoido](https://github.com/gitoido)

---

Top Contributors

[![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)")[![gitoido](https://avatars.githubusercontent.com/u/2114164?v=4)](https://github.com/gitoido "gitoido (8 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)")[![hailam](https://avatars.githubusercontent.com/u/1132869?v=4)](https://github.com/hailam "hailam (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mica-project-editorjs-extendable-parser/health.svg)

```
[![Health](https://phpackages.com/badges/mica-project-editorjs-extendable-parser/health.svg)](https://phpackages.com/packages/mica-project-editorjs-extendable-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)
