PHP code example of setono / editorjs-php

1. Go to this page and download the library: Download setono/editorjs-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

setono / editorjs-php example snippets



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);
bash
composer