Skip to content

Latest commit

 

History

History
74 lines (60 loc) · 2.99 KB

File metadata and controls

74 lines (60 loc) · 2.99 KB

PHP library for easing your development with the EditorJS

Latest Version Software License Build Status Code Coverage Mutation testing

Installation

composer require setono/editorjs-php

Usage

Here is a full example going from json to html output.

<?php
use Setono\EditorJS\Parser\Parser;
use Setono\EditorJS\Renderer\Renderer;

$json = '...'; // this is the actual json you receive from the EditorJS instance

$parser = new Parser();
$parserResult = $parser->parse($json);

$renderer = new Renderer();
$renderer->add(new DelimiterBlockRenderer());
$renderer->add(new HeaderBlockRenderer());
$renderer->add(new ImageBlockRenderer());
$renderer->add(new ListBlockRenderer());
$renderer->add(new ParagraphBlockRenderer());
$renderer->add(new RawBlockRenderer());

$html = $renderer->render($parserResult);

EditorJS plugins supported

A PR adding support for any of the above plugins would be awesome! Thank you 🎉