PHPackages                             shomisha/unusual-relationships - 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. shomisha/unusual-relationships

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

shomisha/unusual-relationships
==============================

This package offers a trait which provides your models with the ability to have relationships not included within standard Laravel installations.

1.0.1(6y ago)81.0k2[1 issues](https://github.com/shomisha/unusual-relationships/issues)MITPHPPHP ~7.0CI failing

Since May 29Pushed 6y agoCompare

[ Source](https://github.com/shomisha/unusual-relationships)[ Packagist](https://packagist.org/packages/shomisha/unusual-relationships)[ Docs](https://github.com/shomisha/unusual-relationships)[ RSS](/packages/shomisha-unusual-relationships/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (3)Versions (3)Used By (0)

Laravel Unusual Relationships
=============================

[](#laravel-unusual-relationships)

[![Latest Stable Version](https://camo.githubusercontent.com/65c890cbbe4bae13559b26117c32685b707a69345f57c748e39cf20251c02947/68747470733a2f2f706f7365722e707567782e6f72672f73686f6d697368612f756e757375616c2d72656c6174696f6e73686970732f762f737461626c65)](https://packagist.org/packages/shomisha/unusual-relationships)[![Software License](https://camo.githubusercontent.com/f251623e510f5909f16ae3f4e6e548dac11340b9fde1a99be26b015b39272c00/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c6174)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/076b717ba310ec569df6f428daf71b02f9166927a9589ce506e11db13b49f467/68747470733a2f2f7472617669732d63692e6f72672f77656172656e656f7069782f6c61726176656c2d6d6f64656c2d7472616e736c6174696f6e2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/shomisha/unusual-relationships.svg?branch=master)[![StyleCI](https://camo.githubusercontent.com/4670dc59a4c90fbd7b52f060c8a312b01b3ace840774db6b023cd63b4b05a192/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3138383431353838322f736869656c643f6272616e63683d6d6173746572267374796c653d666c6174)](https://github.styleci.io/repos/188415882)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/aaffeb853f51b5a781610aa75c16866f06a6a68646239acb0673957d9d857b11/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f73686f6d697368612f756e757375616c2d72656c6174696f6e73686970732f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/shomisha/unusual-relationships/?branch=master)

This package is meant to provide its users with an API to accessing relationships that aren't included in Laravel's base installation. It achieves this effect by utilizing a trait which in turn instantiates custom relationship classes which rely on Laravel's relationship scaffolding.

```
class Employee extends Model {
    public function tasks()
    {
        return $this->belongsToMany(Task::class);
    }

    public function boss()
    {
        return $this->belongsTo(Boss::class);
    }
}

class Boss extends Model {
    use Shomisha\UnusualRelationships\HasUnusualRelationships;

    public function employees()
    {
        return $this->hasMany(Employee::class);
    }

    public function tasks()
    {
        return $this->belongsToManyThrough(Task::class, Employee::class)
    }
}
```

The example above shows how you can use the `belongsToManyThrough` relationship to connect your model to its distantly related models. To learn more about this which methods work with which database structures, as well as how to use those methods, head over to our [wiki pages](https://github.com/shomisha/unusual-relationships/wiki).

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 56.3% 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 ~110 days

Total

2

Last Release

2479d ago

### Community

Maintainers

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

---

Top Contributors

[![shomisha](https://avatars.githubusercontent.com/u/23019509?v=4)](https://github.com/shomisha "shomisha (18 commits)")[![misa-neopix](https://avatars.githubusercontent.com/u/42573490?v=4)](https://github.com/misa-neopix "misa-neopix (14 commits)")

---

Tags

laraveldatabasemodeleloquentRelationships

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/shomisha-unusual-relationships/health.svg)

```
[![Health](https://phpackages.com/badges/shomisha-unusual-relationships/health.svg)](https://phpackages.com/packages/shomisha-unusual-relationships)
```

###  Alternatives

[waad/laravel-model-metadata

A robust Laravel package for handling metadata with JSON casting, custom relation names, and advanced querying capabilities.

854.1k](/packages/waad-laravel-model-metadata)[msafadi/laravel-eloquent-join-with

Laravel Eloquent Join With Relationships

1656.0k](/packages/msafadi-laravel-eloquent-join-with)[designmynight/laravel-elasticsearch

Use Elasticsearch as a database in Laravel to retrieve Eloquent models and perform aggregations.

3041.0k](/packages/designmynight-laravel-elasticsearch)

PHPackages © 2026

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