PHPackages                             kitloong/eloquent-power-joins-with-compoships - 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. kitloong/eloquent-power-joins-with-compoships

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

kitloong/eloquent-power-joins-with-compoships
=============================================

The Laravel magic applied to joins, with compoships support

v2.0.0(7mo ago)2616.4k↓12.5%3MITPHP

Since Sep 3Pushed 7mo ago1 watchersCompare

[ Source](https://github.com/kitloong/eloquent-power-joins-with-compoships)[ Packagist](https://packagist.org/packages/kitloong/eloquent-power-joins-with-compoships)[ Fund](https://www.buymeacoffee.com/kitloong)[ RSS](/packages/kitloong-eloquent-power-joins-with-compoships/feed)WikiDiscussions 1.x Synced 1mo ago

READMEChangelog (4)Dependencies (5)Versions (8)Used By (0)

Eloquent Power Joins with Compoships Support
============================================

[](#eloquent-power-joins-with-compoships-support)

This package is an [Eloquent Power Joins](https://github.com/kirschbaum-development/eloquent-power-joins) extension to support [Compoships](https://github.com/topclaudy/compoships).

You can now use joins in Laravel way, with composite key support.

This package support composite keys for relation:

1. hasOne
2. HasMany
3. belongsTo

You could read the detail explanation at [here](https://kitloong.medium.com/laravel-eloquent-join-with-composite-keys-40a53a4e2dcc).

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

[](#installation)

You can install the package via composer:

```
composer require kitloong/eloquent-power-joins-with-compoships

```

Usage
-----

[](#usage)

To implement join with composite key

```
select users.* from users inner join posts on users.team_id = posts.team_id and users.category_id = posts.category_id;
```

First, you need to define the model relationship the way Compoships did.

```
use Awobaz\Compoships\Compoships;
use Kirschbaum\PowerJoins\PowerJoins;

class User extends Model
{
    use PowerJoins;
    use Compoships;

    public function posts()
    {
        return $this->hasMany(
            Post::class,
            ['team_id', 'category_id'],
            ['team_id', 'category_id']
        );
    }
}
```

Then you can get the same result by simply write

```
User::joinRelationship('posts');
```

License
-------

[](#license)

This package is open-sourced software licensed under the [MIT license](LICENSE)

###  Health Score

44

—

FairBetter than 92% of packages

Maintenance62

Regular maintenance activity

Popularity36

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~296 days

Recently: every ~330 days

Total

6

Last Release

238d ago

Major Versions

v1.2.0 → 2.x-dev2025-09-22

### Community

Maintainers

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

---

Top Contributors

[![kitloong](https://avatars.githubusercontent.com/u/7660346?v=4)](https://github.com/kitloong "kitloong (9 commits)")

---

Tags

composite-keysjoint-modelslaravel-eloquent-modelslaravelmysqleloquentjoin

###  Code Quality

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/kitloong-eloquent-power-joins-with-compoships/health.svg)

```
[![Health](https://phpackages.com/badges/kitloong-eloquent-power-joins-with-compoships/health.svg)](https://phpackages.com/packages/kitloong-eloquent-power-joins-with-compoships)
```

###  Alternatives

[kirschbaum-development/eloquent-power-joins

The Laravel magic applied to joins.

1.6k25.2M34](/packages/kirschbaum-development-eloquent-power-joins)[reedware/laravel-relation-joins

Adds the ability to join on a relationship by name.

2121.2M13](/packages/reedware-laravel-relation-joins)[relaticle/custom-fields

User Defined Custom Fields for Laravel Filament

15828.6k](/packages/relaticle-custom-fields)[msafadi/laravel-eloquent-join-with

Laravel Eloquent Join With Relationships

1646.0k](/packages/msafadi-laravel-eloquent-join-with)[sarfraznawaz2005/indexer

Laravel package to monitor SELECT queries and offer best possible INDEX fields.

562.7k](/packages/sarfraznawaz2005-indexer)

PHPackages © 2026

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