editorjs-php icon indicating copy to clipboard operation
editorjs-php copied to clipboard

PHP SDK for the https://editorjs.io editor

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 :tada: