PHP code example of devscast / editorjs
1. Go to this page and download the library: Download devscast/editorjs 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/ */
devscast / editorjs example snippets
use Devscast\EditorJs\Editor;
$data = <<<JSON
{
"time": 1635603431943,
"blocks": [
{
"id": "1",
"type": "header",
"data": {
"text": "Hello, Editor.js!",
"level": 2
}
},
{
"id": "2",
"type": "paragraph",
"data": {
"text": "This is a paragraph block."
}
}
],
"version": "2.31.0"
}
JSON;
$editor = new Editor($data);
// Get sanitized HTML output
echo $editor->getHtml();