PHPackages                             hirasso/prose - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. hirasso/prose

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

hirasso/prose
=============

Format rich text / prose HTML: obfuscate addresses, mark external links, tidy empty tags 🐘

v0.1.0(1mo ago)01[1 PRs](https://github.com/hirasso/prose/pulls)MITPHPPHP ^8.4 | ^8.5CI passing

Since Jul 10Pushed 1mo agoCompare

[ Source](https://github.com/hirasso/prose)[ Packagist](https://packagist.org/packages/hirasso/prose)[ GitHub Sponsors](https://github.com/hirasso)[ RSS](/packages/hirasso-prose/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (1)Dependencies (6)Versions (3)Used By (0)

hirasso/prose
=============

[](#hirassoprose)

[![Latest Version on Packagist](https://camo.githubusercontent.com/963cdf6d9b38a406a6edff78476ad3fcd451f22b7146a614e16fea846fb0ac38/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6869726173736f2f70726f73653f7374796c653d666c61742d737175617265266c6f676f3d7061636b6167697374266c6f676f436f6c6f723d7768697465)](https://packagist.org/packages/hirasso/prose)[![Test Status](https://camo.githubusercontent.com/4bd6e62f99911f55a16f96416526fcc251d1596f017600d9841c29e4fe7f6647/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6869726173736f2f70726f73652f63692e796d6c3f7374796c653d666c61742d737175617265266c6f676f3d676974687562266c6162656c3d7465737473)](https://github.com/hirasso/prose/actions/workflows/ci.yml)[![Code Coverage](https://camo.githubusercontent.com/843c78705a755f745c6424632ded54cebc32b27ad3c778e6aac2bfddde0794cb/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f6869726173736f2f70726f73653f7374796c653d666c61742d737175617265266c6f676f3d636f6465636f76266c6f676f436f6c6f723d7768697465266c6162656c3d636f766572616765253230253238776861746576657225323074686174253230656e7461696c73253239)](https://app.codecov.io/gh/hirasso/prose)

**Format rich text / prose HTML in PHP. Fully HTML5-compatible 🐘**

A tiny, framework-agnostic formatter for WYSIWYG / rich text content. Pass a string, get a string back:

- Obfuscate email/phone links against spam bots (via [`hirasso/html-obfuscator`](https://github.com/hirasso/html-obfuscator))
- Mark external links (`target="_blank"`, custom attributes)
- Strip tags to an allowlist
- Remove whitespace-only elements (e.g. empty ``)

Installation
------------

[](#installation)

```
composer require hirasso/prose
```

Usage
-----

[](#usage)

```
use Hirasso\Prose\Prose;
use Hirasso\Prose\ProseOptions;

// Minimal: sensible defaults (obfuscate + prune empty )
echo Prose::format($html);

// Configured
echo Prose::format($html, new ProseOptions(
    allowedTags: ['p', 'a', 'br', 'strong', 'em', 'ul', 'li'],
    siteUrl: 'https://example.com',      // required to detect external links
    removeEmptyElements: ['p'],
    obfuscate: true,
));
```

Note

`Prose::format()` expects a **prose fragment**, not a full HTML document. It throws an `InvalidArgumentException` if the input contains ``, ``, `` or ``.

### Options

[](#options)

OptionDefaultPurpose`allowedTags``null`Tags to keep when stripping. `null` = don't strip.`obfuscate``true`Obfuscate email/phone links.`removeEmptyElements``['p']`Selectors of whitespace-only elements to prune.`siteUrl``null`Your site's URL. Required to detect external links.`externalLinkAttributes``['data-external' => '', 'target' => '_blank']`Attributes added to external links.WordPress / ACF
---------------

[](#wordpress--acf)

The package ships no framework glue. Wire it into an `acf/format_value` filter in your project:

```
add_filter('acf/format_value/type=wysiwyg', function (mixed $value, $postID, array $field): mixed {
    if (!is_string($value) || trim($value) === '') {
        return $value;
    }
    return Prose::format($value, new ProseOptions(
        allowedTags: ['p', 'a', 'br', 'blockquote', 'strong', 'b', 'i', 'em', 'ul', 'li', 'sup'],
        siteUrl: home_url(),
    ));
}, 11, 3);

// Inject the obfuscator client script once, in :
add_action('wp_head', fn () => print(\Hirasso\HTMLObfuscator\clientScript()));
```

License
-------

[](#license)

MIT © [Rasso Hilber](https://rassohilber.com)

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance90

Actively maintained with recent releases

Popularity1

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 95.5% 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

Unknown

Total

1

Last Release

49d ago

### Community

Maintainers

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

---

Top Contributors

[![hirasso](https://avatars.githubusercontent.com/u/869813?v=4)](https://github.com/hirasso "hirasso (21 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (1 commits)")

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/hirasso-prose/health.svg)

```
[![Health](https://phpackages.com/badges/hirasso-prose/health.svg)](https://phpackages.com/packages/hirasso-prose)
```

PHPackages © 2026

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