PHP code example of setono / editorjs-bundle

1. Go to this page and download the library: Download setono/editorjs-bundle 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-bundle example snippets




use Setono\EditorJS\Parser\ParserInterface;
use Setono\EditorJS\Renderer\RendererInterface;

final class YourService
{
    public function __construct(
        private readonly ParserInterface $parser,
        private readonly RendererInterface $renderer
    ) {
    }

    public function __invoke(string $json): string
    {
        return $this->renderer->render($this->parser->parse($json));
    }
}