PHPackages                             internetztube/craft-element-relations - 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. internetztube/craft-element-relations

ActiveCraft-plugin

internetztube/craft-element-relations
=====================================

Shows all relations of an element.

3.1.7(6mo ago)317.9k↑300%8[3 issues](https://github.com/internetztube/craft-element-relations/issues)MITPHP

Since Oct 23Pushed 6mo ago1 watchersCompare

[ Source](https://github.com/internetztube/craft-element-relations)[ Packagist](https://packagist.org/packages/internetztube/craft-element-relations)[ RSS](/packages/internetztube-craft-element-relations/feed)WikiDiscussions 3.x Synced 1mo ago

READMEChangelog (10)Dependencies (2)Versions (61)Used By (0)

Element Relations Plugin for Craft CMS 4.x and 5.x
==================================================

[](#element-relations-plugin-for-craft-cms-4x-and-5x)

This plugin shows all relations of an element. For example, where an asset, entry or any other element is linked.

**Feature Requests are welcome!**

[![Share](screenshots/share.png)](screenshots/share.png)[![Asset Detail](screenshots/asset-detail-en.png)](screenshots/asset-detail-en.png)

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

[](#requirements)

This plugin requires Craft CMS 4.0.0 or 5.0.0 later.

**For Craft CMS 4:**When using SEOmatic: MySQL 8.0.17+, MariaDB 10.4.6+, or PostgreSQL 13+ is required.

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

[](#installation)

To install this plugin, follow these steps:

1. Install with Composer via `composer require internetztube/craft-element-relations`
2. Install plugin in the Craft Control Panel under Settings &gt; Plugins

You can also install this plugin via the Plugin Store in the Craft Control Panel.

Support
-------

[](#support)

As a basis the relations table is used. This means that any field that stores relations in the relations table will work out of the box.

- Entries, Assets, Categories, Globals, Users, Products, ...
- Matrix
- Neo
- SuperTable
- User Photo
- SEOmatic
- Redactor
- CkEditor
- Hyper
- LinkIt
- TypedLinkField
- Formie
    ... and many more.

Usage
-----

[](#usage)

### GraphQL

[](#graphql)

The Element Relations field exposes its data in GraphQL. Query the field by its handle to access counts, usage flags, and related elements. Below is a minimal example fetching usage information for a field named `relationsField` on an entry:

```
{
  entry(slug: "my-entry") {
    ... on entry_default_Entry {
      title
      relationsField {
        count
        isInUse
        elements(limit: 2) {
          id
          title
        }

        globalCount: count(siteIds: []),
        globalIsInUse: isInUse(siteIds: []),
        globalElements: elements(
            siteIds: [],
            limit: 2,
            sections: ['sectionHandle'],
            entryTypes: ['entryTypeHandle']
        ) {
          id
          title
        }
      }
    }
  }
}
```

### Twig

[](#twig)

Obtain a `RelationsModel` instance from any element’s relations field, then use its methods to inspect usage.

```
{# Fetch the RelationsModel from a field named `relationsField` #}

{# @var relationsModel \internetztube\elementRelations\models\RelationsModel #}
{% set relationsModel = element.relationsField %}
```

#### Is in use?

[](#is-in-use)

```
{# Check if the element is used in the current site #}
{% if relationsModel.isInUse %}
    {# ... #}
{% endif %}

{# Check usage across all sites #}
{% if relationsModel.isInUse([]) %}
    {# ... #}
{% endif %}

{# Check usage in specific sections/entry types #}
{% if relationsModel.isInUse(sections: ['sectionHandle'], entryTypes: ['entryTypeHandle']) %}
    {# ... #}
{% endif %}
```

#### Elements

[](#elements)

```
{# All related elements in elements site #}
{% set elements = relationsModel.elements %}

{# All related elements across all sites #}
{% set allElements = relationsModel.elements(siteIds: []) %}

{# Filter by specific site id(s) #}
{% set site1Elements = relationsModel.elements(siteIds: [1]) %}

{# Limit number of results (e.g., first 2 items) #}
{% set firstTwo = relationsModel.elements(siteIds: [], limit: 2) %}

{# Filter by sections and entry types #}
{% set filteredElements = relationsModel.elements(sections: ['sectionHandle'], entryTypes: ['entryTypeHandle']) %}

{# Combine filters with limit #}
{% set limitedFiltered = relationsModel.elements(limit: 5, sections: ['news', 'blog']) %}

{# All options #}
{% set elements = relationsModel.elements(
    siteIds: [],
    limit: null,
    offset: 0,
    sections: [],
    entryTypes: []
) %}
```

#### Elements Iterator

[](#elements-iterator)

```
{% for element in relationsModel.elementsIterator(siteIds: [], limit: null, offset: 0, batchSize: 100) %}
    {{ dump(element) }}
{% endfor %}

{# Filter by sections/entry types while iterating #}
{% for element in relationsModel.elementsIterator(sections: ['news'], entryTypes: ['article'], limit: 50) %}
    {{ element.title }}
{% endfor %}
```

#### Sites

[](#sites)

```
{# List of sites where the element is in use #}
{% set sites = relationsModel.sites %}
```

#### Special / SEOmatic

[](#special--seomatic)

```
{# Detect usage in SEOmatic global settings #}
{% if relationsModel.isUsedInSeomaticGlobalSettings %}
    {# ... #}
{% endif %}
```

Screenshots
-----------

[](#screenshots)

Asset Overview [![Asset Overview Primary Page](screenshots/asset-overview.png)](screenshots/asset-overview.png)

---

Asset detail [![Asset Detail](screenshots/asset-detail-en.png)](screenshots/asset-detail-en.png)

---

Create Field [![Field Edit Page](screenshots/field.png)](screenshots/field.png)

---

Add to Field Layout [![Field Edit Page](screenshots/fieldlayout.png)](screenshots/fieldlayout.png)

Issues
------

[](#issues)

Please report any issues you find to the [Issues](https://github.com/internetztube/craft-element-relations/issues) page.

Brought to you by [Frederic Koeberl](https://frederickoeberl.com/)

###  Health Score

43

—

FairBetter than 90% of packages

Maintenance50

Moderate activity, may be stable

Popularity31

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 92.5% 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 ~24 days

Recently: every ~14 days

Total

60

Last Release

206d ago

Major Versions

1.3.6 → 2.0.0-beta.12022-05-11

1.3.7 → 2.0.12022-08-27

1.3.10 → 2.0.22022-09-01

2.x-dev → 3.0.02024-06-18

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/6382364?v=4)[Frederic Köberl](/maintainers/internetztube)[@internetztube](https://github.com/internetztube)

---

Top Contributors

[![internetztube](https://avatars.githubusercontent.com/u/6382364?v=4)](https://github.com/internetztube "internetztube (222 commits)")[![gbowne-quickbase](https://avatars.githubusercontent.com/u/39066452?v=4)](https://github.com/gbowne-quickbase "gbowne-quickbase (15 commits)")[![albertvisuals](https://avatars.githubusercontent.com/u/60854302?v=4)](https://github.com/albertvisuals "albertvisuals (1 commits)")[![sfsmfc](https://avatars.githubusercontent.com/u/5294925?v=4)](https://github.com/sfsmfc "sfsmfc (1 commits)")[![webrgp](https://avatars.githubusercontent.com/u/994788?v=4)](https://github.com/webrgp "webrgp (1 commits)")

---

Tags

craft-plugincraftcmscmsCraftcraftcmscraft-pluginelement-relations

### Embed Badge

![Health badge](/badges/internetztube-craft-element-relations/health.svg)

```
[![Health](https://phpackages.com/badges/internetztube-craft-element-relations/health.svg)](https://phpackages.com/packages/internetztube-craft-element-relations)
```

###  Alternatives

[nystudio107/craft-seomatic

SEOmatic facilitates modern SEO best practices &amp; implementation for Craft CMS 5. It is a turnkey SEO system that is comprehensive, powerful, and flexible.

1741.4M46](/packages/nystudio107-craft-seomatic)[verbb/image-resizer

Resize assets when they are uploaded.

127269.1k7](/packages/verbb-image-resizer)[verbb/formie

The most user-friendly forms plugin for Craft.

101372.9k40](/packages/verbb-formie)[verbb/tablemaker

Create customizable and user-defined table fields.

40168.8k1](/packages/verbb-tablemaker)[wrav/oembed

A simple plugin to extract media information from websites, like youtube videos, twitter statuses or blog articles.

36205.0k3](/packages/wrav-oembed)[verbb/hyper

A user-friendly links field for Craft.

24130.9k9](/packages/verbb-hyper)

PHPackages © 2026

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