cboxdk/statamic-reverse-relationship

Traverse relationships in reverse — see which entries, terms, or assets reference the current item without storing anything on it.

Installs: 0

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 3

Open Issues: 0

Type:statamic-addon

pkg:composer/cboxdk/statamic-reverse-relationship

v2.1.1 2026-02-27 23:54 UTC

This package is auto-updated.

Last update: 2026-02-27 23:54:56 UTC


README

A Statamic addon that lets you traverse relationships in reverse. If entry B points to entry A, this addon lets A see all the B's that reference it — from a single source of truth, with no duplicated data and nothing to keep in sync.

Works with entries, taxonomy terms, and assets.

The Problem

You have a comments collection where each comment points to a blog post. You want the blog post to show its comments. Without this addon, you'd have to manually maintain a list of comment IDs on each post — duplicating data and hoping it stays in sync.

The Solution

Add the reverse_relationship fieldtype to your blog post blueprint, tell it to look in the comments collection for entries whose post field points here, and you're done:

- handle: comments
  field:
    type: reverse_relationship
    collection: comments
    field: post

Then use it in your templates — just like any native Statamic field:

{{ comments sort="date:desc" limit="5" }}
    <p>{{ author }}: {{ content }}</p>
{{ /comments }}

Features

  • Fieldtype — add to any blueprint, works like a native entries field in templates
  • Antlers tag — query reverse relationships from any template, no blueprint required
  • Editable mode — attach/detach related items directly from the CP
  • Lazy query builderlimit, sort, paginate, count, and scoped variables
  • Three modes — entries, taxonomy terms, and assets

Quick Start

composer require cboxdk/statamic-reverse-relationship

No config files, no publishing, no migrations.

Documentation

See DOCUMENTATION.md for full setup guide, templating examples, and configuration reference.

Requirements

  • PHP 8.2+
  • Statamic 6.x
  • Laravel 12+

Development

composer check    # Pint + PHPStan level 9 + Pest (69 tests)

License

MIT

Credits

Originally designed and developed by Sylvester Damgaard while working at TV2 Regionerne. Now maintained and actively developed under Cbox with a full rewrite for Statamic 6, Laravel 12, and Vue 3.