PHPackages                             hugo-levet/strapi-php-rich-text-parser - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. hugo-levet/strapi-php-rich-text-parser

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

hugo-levet/strapi-php-rich-text-parser
======================================

A PHP parser for Strapi Rich Text fields

v1.3.3(1y ago)027[1 issues](https://github.com/hugo-levet/strapi-php-rich-text-parser/issues)MITPHP

Since Aug 20Pushed 1y ago1 watchersCompare

[ Source](https://github.com/hugo-levet/strapi-php-rich-text-parser)[ Packagist](https://packagist.org/packages/hugo-levet/strapi-php-rich-text-parser)[ RSS](/packages/hugo-levet-strapi-php-rich-text-parser/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (9)Dependencies (1)Versions (10)Used By (0)

strapi-php-rich-text-parser
===========================

[](#strapi-php-rich-text-parser)

[![Latest Version](https://camo.githubusercontent.com/cf220e3d566aeb7b6cbbbcbf070761fbfd03bc1504b049053766f7c2e6996cf8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6875676f2d6c657665742f7374726170692d7068702d726963682d746578742d7061727365722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/hugo-levet/strapi-php-rich-text-parser)[![Total Downloads](https://camo.githubusercontent.com/3477b8f31b1c0b0f9e241ecd46366d459c399e4db2c53ecf57eb57be473461db/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6875676f2d6c657665742f7374726170692d7068702d726963682d746578742d7061727365722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/hugo-levet/strapi-php-rich-text-parser)[![Software License](https://camo.githubusercontent.com/c2bffd81d308ced1cc3b0d66fb0ed453ab478a5e17c988b780f9de986a390ee2/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)

A PHP parser for Strapi Rich Text fields

Usage
-----

[](#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
----------------

[](#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
---------------------

[](#environment-variables)

Make sure to set the environment variable `STRAPI_URL` with the URL of the Strapi API you are using

For development
---------------

[](#for-development)

To run the tests, use the following command:

```
./vendor/bin/phpunit tests
```

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance44

Moderate activity, may be stable

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~23 days

Recently: every ~3 days

Total

9

Last Release

443d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a1971829f693792c9ebf4d675a76889390e00e83896ae6e4267ed361da3be62e?d=identicon)[hugolevet](/maintainers/hugolevet)

---

Top Contributors

[![hugo-levet](https://avatars.githubusercontent.com/u/49909831?v=4)](https://github.com/hugo-levet "hugo-levet (17 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/hugo-levet-strapi-php-rich-text-parser/health.svg)

```
[![Health](https://phpackages.com/badges/hugo-levet-strapi-php-rich-text-parser/health.svg)](https://phpackages.com/packages/hugo-levet-strapi-php-rich-text-parser)
```

###  Alternatives

[mtdowling/jmespath.php

Declaratively specify how to extract elements from a JSON document

2.0k472.8M135](/packages/mtdowling-jmespathphp)[opis/closure

A library that can be used to serialize closures (anonymous functions) and arbitrary data.

2.6k230.0M284](/packages/opis-closure)[masterminds/html5

An HTML5 parser and serializer.

1.8k242.8M229](/packages/masterminds-html5)[sabberworm/php-css-parser

Parser for CSS Files written in PHP

1.8k191.2M65](/packages/sabberworm-php-css-parser)[michelf/php-markdown

PHP Markdown

3.5k52.4M345](/packages/michelf-php-markdown)[jms/metadata

Class/method/property metadata management in PHP

1.8k152.8M88](/packages/jms-metadata)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
