承接 hugo-levet/strapi-php-rich-text-parser 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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

Latest Version Total Downloads Software License

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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-08-20