承接 jorisnoo/statamic-safe-entities 相关项目开发

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

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

jorisnoo/statamic-safe-entities

最新稳定版本:0.2.0

Composer 安装命令:

composer require 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.).

README 文档

README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

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

composer require jorisnoo/statamic-safe-entities

Configuration

Publish the config file to customize which entities are available:

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

Default configuration:

return [
    'entities' => [
        '­' => 'Soft Hyphen',
        ' ' => 'Non-Breaking Space',
        '–' => 'En Dash',
    ],
];

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

Usage

Bard toolbar

The addon adds an "&" 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

Two Blade directives are available for rendering entities safely:

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

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

<p>@entities($entry->title)</p>

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

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

<div>@entitiesHtml($entry->content)</div>

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

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Credits

License

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

统计信息

  • 总下载量: 114
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-03-18

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固