PHPackages                             visuellverstehen/statamic-content-renderer - 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. [Search &amp; Filtering](/categories/search)
4. /
5. visuellverstehen/statamic-content-renderer

ActiveStatamic-addon[Search &amp; Filtering](/categories/search)

visuellverstehen/statamic-content-renderer
==========================================

A Statamic search transformer for bard and replicator fields.

v2.0.0(2mo ago)16.8k↓42.2%1MITPHPPHP ^8.2CI passing

Since Apr 24Pushed 2mo ago5 watchersCompare

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

READMEChangelog (10)Dependencies (5)Versions (17)Used By (0)

Content Renderer
================

[](#content-renderer)

A Statamic addon that renders content from bard and replicator fields to make their content searchable with [search transformers](https://statamic.dev/search#transforming-fields).

Requirements
------------

[](#requirements)

VersionStatamicPHP2.x^6.0^8.21.x^3.4 || ^4.0 || ^5.0^8.1How to Install
--------------

[](#how-to-install)

Run the following command from your project root:

```
composer require visuellverstehen/statamic-content-renderer
```

How to Use
----------

[](#how-to-use)

The content renderer is available through the `Renderer()` class. To render the content of a replicator or bard field, the class requires a view that provides the info of how to display all the configured sets, e. g.:

```
{{# resources/views/sets.antlers.php #}}

{{ my_replicator_field }}
    {{ partial src="sets/{type}" }}
{{ /my_replicator_field }}
```

This view needs to be passed on to the renderer class.

```
use VV\ContentRenderer\Renderer;

// ...

$renderer = new Renderer();
$renderer->setContent($entry, 'my_replicator_field');
$renderer->setView('sets');

$content = $renderer->render();
```

The renderer uses the view to render all sets (and all written content of bard fields), sanitizes the content (strips all HTML tags etc.) and returns a string containing every written word from within the field.

This can be used within a [search transformer](https://statamic.dev/search#transforming-fields) to make the content of bard and replicator fields available for full-text search:

```
namespace App\SearchTransformers;

use VV\ContentRenderer\Renderer;

class MyReplicatorFieldTransformer
{
    public function handle($value, $field, $searchable)
    {
        $renderer = new Renderer();
        $renderer->setContent($searchable, 'my_replicator_field');
        $renderer->setView('sets');

        return $renderer->render();
    }
}
```

### Preserving links targets

[](#preserving-links-targets)

When using the Content Renderer within a search transformer, it might be useful to preserve link targets in the rendered output. This makes it possible to find entries based on urls linked in the content. You can instruct the renderer to add link targets in parenthesis behind the link text:

```
$renderer = (new Renderer())->withLinkTargets();

// read more about the author of this package
// becomes: read more about the author (https://visuellverstehen.de) of this package
```

### Preserving HTML tags

[](#preserving-html-tags)

If you want to keep the HTML tags and/or modify the content in your own way, you can instruct the renderer not to strip them:

```
$renderer = (new Renderer())->withHtmlTags();
```

**Note:** If you choose to preserve HTML tags, the `withLinkTargets` option (see above) will be ignored.

### Custom processor

[](#custom-processor)

If you need to modify the content before it is passed on to the render process, you can optionally add a custom processor function:

```
$renderer = new Renderer();
$renderer->setContent($searchable, 'bard_content');
// …

$renderer->process(function ($content) {
    // modify content

    return $content;
});
```

This allows you to e. g. remove certain sets or modify the content in any other way.

### Using a Value object directly

[](#using-a-value-object-directly)

If you already have a Value object (`Statamic\Fields\Value`, e. g. from a fieldtype), you can pass it directly to the renderer using `setValue()` instead of `setContent()`:

```
$renderer = new Renderer();
$renderer->setValue($fieldValue);

$content = $renderer->render();
```

The renderer will automatically resolve the entry and field handle from the Value object.

Upgrading
---------

[](#upgrading)

### From v1.x to v2.0

[](#from-v1x-to-v20)

Version 2.0 is a major release that aligns with Statamic v6. It contains breaking changes.

#### Requirements

[](#requirements-1)

- PHP 8.2+ (up from 8.1)
- Statamic 6.0+ (dropped support for v3/v4/v5)

#### Custom Processor Changes

[](#custom-processor-changes)

The `process()` callback now receives **raw field data** instead of data processed through Statamic's CP pipeline.

**For most users, no changes are needed.** The data structure for filtering by `type` is identical:

```
// This works the same in v1.x and v2.x
$renderer->process(function ($content) {
    return array_filter($content, fn ($item) => ($item['type'] ?? null) !== 'set');
});
```

However, if you were modifying inner field values within sets, those values will now be raw instead of processed through their respective fieldtypes. Adjust your callback accordingly:

```
// v1.x - values were processed
$renderer->process(function ($content) {
    // $content[0]['text'] was already processed as a Text fieldtype value
});

// v2.x - values are raw
$renderer->process(function ($content) {
    // $content[0]['text'] is the raw string value from the entry
});
```

#### Internal Changes

[](#internal-changes)

- The internal `preProcess()`/`process()` round-trip has been removed
- The Renderer now uses Statamic's public fieldtype `augment()` API directly
- `renderWithoutView()` now uses the fieldtype's own Bard configuration instead of `CoreModifiers::bardHtml()`

See the [CHANGELOG](CHANGELOG.md) for full details.

More about us
-------------

[](#more-about-us)

- [www.visuellverstehen.de](https://visuellverstehen.de)

License
-------

[](#license)

The MIT license (MIT). Please take a look at the [license file](LICENSE.md) for more information.

###  Health Score

51

—

FairBetter than 96% of packages

Maintenance88

Actively maintained with recent releases

Popularity26

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity65

Established project with proven stability

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

Recently: every ~161 days

Total

13

Last Release

60d ago

Major Versions

v0.2.2 → v1.0.02024-05-08

v1.1.0 → v2.0.02026-03-19

PHP version history (3 changes)v0.1.0-betaPHP ^8.0

v0.1.1-betaPHP ^8.1

v2.0.0PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/57dcd9370600b66b5ad7d99dd2b633e36d3a9458e656d650045f5f5eaf540e2d?d=identicon)[visuellverstehen](/maintainers/visuellverstehen)

![](https://www.gravatar.com/avatar/16b77aabdc6e9a51c63341aa7ad7b295b05bb05b1814b1218963a806f2341f68?d=identicon)[simonerd](/maintainers/simonerd)

---

Top Contributors

[![simonerd](https://avatars.githubusercontent.com/u/7941370?v=4)](https://github.com/simonerd "simonerd (32 commits)")

---

Tags

searchcontentfulltextaddonstatamicreplicatorbard

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/visuellverstehen-statamic-content-renderer/health.svg)

```
[![Health](https://phpackages.com/badges/visuellverstehen-statamic-content-renderer/health.svg)](https://phpackages.com/packages/visuellverstehen-statamic-content-renderer)
```

###  Alternatives

[teamtnt/tntsearch

A fully featured full text search engine written in PHP

3.2k3.0M28](/packages/teamtnt-tntsearch)[marcorieser/statamic-live-search

A Statamic Live Search realized with Laravel Livewire.

2210.5k](/packages/marcorieser-statamic-live-search)[statamic-rad-pack/meilisearch

meilisearch search driver for Statamic

1661.7k](/packages/statamic-rad-pack-meilisearch)[visuellverstehen/statamic-classify

A useful helper to add CSS classes to all HTML tags generated by the bard editor.

20116.8k](/packages/visuellverstehen-statamic-classify)[blomstra/search

Replaces Flarum search with one powered by an elastic search server.

114.9k](/packages/blomstra-search)

PHPackages © 2026

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