PHP code example of muhammadsiyab / editorjs-parser-php
1. Go to this page and download the library: Download muhammadsiyab/editorjs-parser-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/ */
muhammadsiyab / editorjs-parser-php example snippets
use MuhammadSiyab\EditorjsParserPhp\Parser;
# The json output generated by Editor.js
$content = '{"time": 1711232666978,"blocks": [{...}]}' ;
$parser = new Parser();
$parsed = $parser->parse($content);
echo $parsed; // outputs the generated HTML
# Only parses the `headings` and `paragraphs`
$parsed = $parser
->only('header', 'paragraph') // can be parsed using the array syntax ['header', 'paragraph']
->parse($content);
# Parses all the blocks except `list` and `code`
$parsed = $parser
->except('list', 'code') // can be parsed using the array syntax ['list', 'code']
->parse($content);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.