hugo-levet/strapi-php-rich-text-parser
最新稳定版本:v1.3.3
Composer 安装命令:
composer require hugo-levet/strapi-php-rich-text-parser
包简介
A PHP parser for Strapi Rich Text fields
README 文档
README
A PHP parser for Strapi Rich Text fields
Usage
Get data from the Strapi API in StdClass format and pass it to the parser
use HugoLevet\StrapiPhpRichTextParser\RichTextParser; $html_content = RichTextParser::jsonToHtml($content);
Using Shortcodes
You can add shortcodes like in WordPress by passing an array of shortcodes and their associated functions to the jsonToHtml function. For example:
$shortcodes = [ 'shortcode' => 'shortcodeFunction' ]; function shortcodeFunction($element) { return 'Wubba Lubba Dub Dub'; } $html = jsonToHtml($json, $shortcodes); echo $html;
Environment variables
Make sure to set the environment variable STRAPI_URL with the URL of the Strapi API you are using
For development
To run the tests, use the following command:
./vendor/bin/phpunit tests
统计信息
- 总下载量: 27
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-08-20