cboxdk/statamic-reverse-relationship

Traverse relationships in reverse — see which entries, terms, or assets reference the current item without storing anything on it.
1,723 1
Install
composer require cboxdk/statamic-reverse-relationship
Latest Version:v2.1.2
PHP:^8.2
Laravel:12 · 13
License:MIT
Last Updated:Apr 21, 2026
Links: GitHub  ·  Packagist
Maintainer: cboxdk

Reverse Relationship for Statamic

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 builder — limit, 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.

Related Packages

visuellverstehen/statamic-asset-atlas

Track where your Statamic assets are used to make moving, replacing and deleting...

38,639 1
visuellverstehen/statamic-advanced-invalidator

A Statamic invalidation class for static caching with advanced capabilities.

1,177 0
jonassiewertsen/statamic-external-link

A Statamic fieldtype for external links

88,309 8
visuellverstehen/statamic-classify

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

125,334 20

Version History

Version Released PHP License
v2.1.2 ^8.2 MIT
v2.1.1 ^8.2 MIT
v2.1.0 ^8.2 MIT
v2.0.0 ^8.2 MIT