PHPackages                             jorisnoo/statamic-safe-entities - 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. jorisnoo/statamic-safe-entities

ActiveStatamic-addon[Utility &amp; Helpers](/categories/utility)

jorisnoo/statamic-safe-entities
===============================

A Statamic addon that provides a Blade directive and Bard buttons for safe HTML entity insertion (soft hyphens, non-breaking spaces, etc.).

0.1.1(1mo ago)022↓100%[1 PRs](https://github.com/jorisnoo/statamic-safe-entities/pulls)MITPHPPHP ^8.2CI passing

Since Mar 18Pushed 1mo agoCompare

[ Source](https://github.com/jorisnoo/statamic-safe-entities)[ Packagist](https://packagist.org/packages/jorisnoo/statamic-safe-entities)[ RSS](/packages/jorisnoo-statamic-safe-entities/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (3)Versions (3)Used By (0)

Statamic Safe Entities
======================

[](#statamic-safe-entities)

[![Latest Version on Packagist](https://camo.githubusercontent.com/aeb63136cdc1530b35768e0e79ec8c79ac8f136b177fb2bba41ea1fd7cd22581/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6a6f7269736e6f6f2f73746174616d69632d736166652d656e7469746965732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/jorisnoo/statamic-safe-entities)[![GitHub Tests Action Status](https://camo.githubusercontent.com/8f8cb6a9e9f0863eb8cfb7904799fa49eb385892ba185a9357d147cb554b5149/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6a6f7269736e6f6f2f73746174616d69632d736166652d656e7469746965732f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/jorisnoo/statamic-safe-entities/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/93b5196f15fc3c1dc6139381dc75f4b671b134334f74a0d6797ded36e329f582/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6a6f7269736e6f6f2f73746174616d69632d736166652d656e7469746965732f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/jorisnoo/statamic-safe-entities/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/116a662242fd7f64857afdd36bbf7405d297add1d5fadfce03722a2775294ffb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6a6f7269736e6f6f2f73746174616d69632d736166652d656e7469746965732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/jorisnoo/statamic-safe-entities)

A Statamic addon for safe HTML entity insertion in Bard, text, and textarea fields. Adds a Bard toolbar button for inserting soft hyphens, non-breaking spaces, en dashes, and other typography entities, plus Blade directives to render them safely.

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

[](#installation)

```
composer require jorisnoo/statamic-safe-entities
```

Configuration
-------------

[](#configuration)

Publish the config file to customize which entities are available:

```
php artisan vendor:publish --tag="safe-entities-config"
```

Default configuration:

```
return [
    'entities' => [
        '&shy;' => 'Soft Hyphen',
        '&nbsp;' => 'Non-Breaking Space',
        '&ndash;' => 'En Dash',
    ],
];
```

Each entry maps an entity code to a label shown in the Bard toolbar dropdown.

Usage
-----

[](#usage)

### Bard toolbar

[](#bard-toolbar)

The addon adds an "&amp;" button to the Bard toolbar. Clicking it shows a dropdown of configured entities. Selecting one inserts the entity code at the cursor position.

### Blade directives

[](#blade-directives)

Two Blade directives are available for rendering entities safely:

#### `@entities($text)` — for text/textarea fields

[](#entitiestext--for-texttextarea-fields)

Escapes the string for safe HTML output, then restores configured entity codes so they render as actual entities.

```
@entities($entry->title)
```

#### `@entitiesHtml($html)` — for Bard/rich-text fields

[](#entitieshtmlhtml--for-bardrich-text-fields)

Restores double-encoded entities (`&amp;shy;` back to `&shy;`) in already-rendered HTML.

```
@entitiesHtml($entry->content)
```

### PHP

[](#php)

You can also call the methods directly:

```
use Noo\SafeEntities\SafeEntities;

$text = SafeEntities::render($value);
$html = SafeEntities::renderHtml($value);
```

Both methods accept an optional second argument to override which entities to restore:

```
SafeEntities::render($value, ['&shy;', '&nbsp;']);
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Credits
-------

[](#credits)

- [Joris Noordermeer](https://github.com/jorisnoo)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE) for more information.

###  Health Score

39

—

LowBetter than 85% of packages

Maintenance96

Actively maintained with recent releases

Popularity9

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

 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 ~0 days

Total

2

Last Release

52d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0440b6ac994d5566a2ef5886fbac104a73f8458e70dbd20085e241ab0f647e0d?d=identicon)[jorgenoo](/maintainers/jorgenoo)

---

Top Contributors

[![jorisnoo](https://avatars.githubusercontent.com/u/5810772?v=4)](https://github.com/jorisnoo "jorisnoo (11 commits)")

---

Tags

hyphenationtypographyentitiesStatamic addon

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/jorisnoo-statamic-safe-entities/health.svg)

```
[![Health](https://phpackages.com/badges/jorisnoo-statamic-safe-entities/health.svg)](https://phpackages.com/packages/jorisnoo-statamic-safe-entities)
```

###  Alternatives

[jolicode/jolitypo

Microtypography fixer for the web.

3471.1M5](/packages/jolicode-jolitypo)[michelf/php-smartypants

PHP SmartyPants

1115.3M30](/packages/michelf-php-smartypants)[org_heigl/hyphenator

Word-Hyphenation for PHP based on the TeX-Hyphenation algorithm

541.3M14](/packages/org-heigl-hyphenator)[alt-design/alt-sitemap

Alt Sitemap addon, create a sitemap from Statamic entries

1219.0k](/packages/alt-design-alt-sitemap)[sunnysideup/typography

Add a typography test page to your silverstripe website / application.

124.2k3](/packages/sunnysideup-typography)

PHPackages © 2026

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