PHPackages                             musamba/red-thread - 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. [Database &amp; ORM](/categories/database)
4. /
5. musamba/red-thread

ActiveLibrary[Database &amp; ORM](/categories/database)

musamba/red-thread
==================

Red Thread is a laravel package that helps you easily list all relationships within a given model.

1.0.3(2y ago)26MITPHPPHP ^8.1

Since Mar 2Pushed 1y ago1 watchersCompare

[ Source](https://github.com/Musamba24/red-thread)[ Packagist](https://packagist.org/packages/musamba/red-thread)[ Docs](https://github.com/Musamba24/red-thread)[ GitHub Sponsors](https://github.com/musamba24)[ RSS](/packages/musamba-red-thread/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (4)Versions (13)Used By (0)

RedThread
=========

[](#redthread)

[![Latest Version on Packagist](https://camo.githubusercontent.com/935243492edb94eb7b4fbad6858b2041f0e1b5bd78c7e92e7d1d184f692a7817/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d7573616d62612f7265642d7468726561642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/musamba/red-thread)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Total Downloads](https://camo.githubusercontent.com/259c01fb0c6a3f783b2ddbcc738792714ad3ff32ae2f653760c6488082bfddd0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d7573616d62612f7265642d7468726561642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/musamba/red-thread)

RedThread is a simple package that allows you to list your Laravel models relationships.

> The two people connected by the red thread are destined lovers, regardless of place, time, or circumstances. This magical cord may stretch or tangle, but never break.

---

Table of Contents
-----------------

[](#table-of-contents)

- [Installation](#installation)
- [Usage](#usage)
- [Testing](#testing)
- [Changelog](#changelog)
- [Contributing](#contributing)
- [Security Vulnerabilities](#security-vulnerabilities)
- [Credits](#credits)
- [License](#license)

---

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

[](#installation)

You can install the package via composer:

```
composer require musamba/red-thread
```

You can publish the config file with:

```
php artisan vendor:publish --tag="red-thread"
```

Usage
-----

[](#usage)

You simply need to use the `HasRedThreads` trait in your model and call the `relationships` method. Here is an example:

```
use Musamba\RedThread\Traits\HasRedThreads;
use Musamba\RedThread\Attributes\RedThread;

class Book extends Model
{
    use HasRedThreads;

    // ...

    #[RedThread]
    public function reviews(): HasMany
    {
        return $this->hasMany(Review::class);
    }

    #[RedThread]
    public function author(): BelongsTo
    {
        return $this->belongsTo(Author::class);
    }

    // ...
}
```

Calling the provided `relationships()` static method on a model instance:

```
Book::relationships();
```

An array containing all the relationships will be returned.

```
[
    'reviews' => 'Illuminate\Database\Eloquent\Relations\HasMany',
    'author' => 'Illuminate\Database\Eloquent\Relations\BelongsTo',
]
```

If the `check_for_attribute` configuration key is set to `false`, the package will check the return type of the method, so having a situation like this:

```
use Musamba\RedThread\Traits\HasRedThreads;

class Book extends Model
{
    use HasRedThreads;

    // ...

    public function reviews(): HasMany
    {
        return $this->hasMany(Review::class);
    }

    public function author(): BelongsTo
    {
        return $this->belongsTo(Author::class);
    }

    // ...
}
```

The same array as above will be returned.

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Feel free to contribute to this package and help me to improve it. You can contribute by opening an issue or a pull request.

Roadmap
-------

[](#roadmap)

- Add artisan command to list relationships via CLI.
- Add related model class and foreign key information.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

If you discover a security vulnerability within RedThread, please open an issue.

Credits
-------

[](#credits)

- [Andrea Musmarra](https://github.com/Musamba24)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance26

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 95% 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 ~0 days

Total

12

Last Release

803d ago

Major Versions

0.9.0 → 1.0.02024-03-05

### Community

Maintainers

![](https://www.gravatar.com/avatar/afb940c82368601e8df3887ceaa553c9d7373ff5a4aa0ad7ee9f594bdf8a0d90?d=identicon)[Musamba](/maintainers/Musamba)

---

Top Contributors

[![Musamba24](https://avatars.githubusercontent.com/u/83073028?v=4)](https://github.com/Musamba24 "Musamba24 (19 commits)")[![andrea-musmarra](https://avatars.githubusercontent.com/u/247759372?v=4)](https://github.com/andrea-musmarra "andrea-musmarra (1 commits)")

---

Tags

laraveleloquentmodelsRelationshipsmusambared-thread

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/musamba-red-thread/health.svg)

```
[![Health](https://phpackages.com/badges/musamba-red-thread/health.svg)](https://phpackages.com/packages/musamba-red-thread)
```

###  Alternatives

[mopo922/laravel-treats

A collection of goodies for Laravel 5.

108451.6k1](/packages/mopo922-laravel-treats)[indexzer0/eloquent-filtering

Powerful eloquent filtering

22425.9k3](/packages/indexzer0-eloquent-filtering)[moneo/laravel-morphmap

Custom morphMap support for Laravel Framework

521.6k](/packages/moneo-laravel-morphmap)[pursehouse/modeler-laravel-eloquent

Generate model classes for Eloquent in Laravel

112.4k](/packages/pursehouse-modeler-laravel-eloquent)

PHPackages © 2026

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