muhammadsiyab/editorjs-parser-php
最新稳定版本:v1.0.1
Composer 安装命令:
composer require muhammadsiyab/editorjs-parser-php
包简介
PHP parser for editorjs library
关键字:
README 文档
README
This package allows you to easily parse Editor.js JSON output to HTML using PHP. This package is currently able to parse the blocks from these plugins:
- Paragraph
- Header
- Image
- Quote
- List
- Nested List
- Code
- Embed (Currently, the following embed blocks are supported)
- Youtube
- Twitter/X
- Codepen
- Github (gist)
Requirements
PHP >=7.4
Installation
composer require muhammadsiyab/editorjs-parser-php
Using
require "vendor/autoload.php"; 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
Allow only specific blocks for parsing
# Only parses the `headings` and `paragraphs` $parsed = $parser ->only('header', 'paragraph') // can be parsed using the array syntax ['header', 'paragraph'] ->parse($content);
Disable specific blocks from being parsed
# Parses all the blocks except `list` and `code` $parsed = $parser ->except('list', 'code') // can be parsed using the array syntax ['list', 'code'] ->parse($content);
License
This Package is open-sourced software licensed under the MIT license
统计信息
- 总下载量: 396
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-04-01