setono / editorjs-php
PHP library for handling data from the EditorJS
Fund package maintenance!
Setono
Installs: 35 473
Dependents: 2
Suggesters: 0
Security: 0
Stars: 38
Watchers: 4
Forks: 3
Open Issues: 1
Requires
- php: >=8.1
- azjezz/psl: ^2.5
- cuyz/valinor: ^1.9
- psr/log: ^1.1 || ^2.0 || ^3.0
- setono/html-element: ^1.0
- symfony/options-resolver: ^4.4 || ^5.4 || ^6.0 || ^7.0
Requires (Dev)
- infection/infection: ^0.27
- php-standard-library/psalm-plugin: ^2.3
- phpunit/phpunit: ^9.6
- psalm/plugin-phpunit: ^0.18
- setono/code-quality-pack: ^2.6
This package is auto-updated.
Last update: 2024-10-29 10:18:46 UTC
README
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
- attaches
- checklist
- code
- delimiter
- embed
- header
- image
- inline-code
- link
- link-autocomplete
- list
- marker
- nested-list
- paragraph
- personality
- quote
- raw
- simple-image
- table
- underline
- warning
A PR adding support for any of the above plugins would be awesome! Thank you 🎉